Interface
Inheritance
Some useful interfaces
found in the Java API:
List
- implemented by ArrayList |
|
Runnable
- implemented by Applets for threading purposes |
|
ActionListener
- implemented by GUI event-handlers |
An abstract class in Java is similar to an interface in that it cannot
be instantiated and provides a set of methods that an inheriting class can
implement. Methods in an abstract
class declared as abstract must be implemented by an inheriting class, much like
any method declared in an interface. Because
abstract methods contain no implementation, a class that contains an abstract
method is considered incomplete, and can therefore not be instantiated.
In other words, any class containing an abstract method becomes abstract
itself, and must be declared so. Even
if an abstract class contains no abstract methods, it still cannot be
instantiated. Similarly, any subclass that does not implement all abstract
methods is also abstract.