The Department of Computer Science & Engineering
STUART C. SHAPIRO: CSE 115 C
To replace multiple inheritance, although a Java class may only extend one superclass, it may implement any number of interfaces.
An interface is similar to an abstract class, but contains no
instance variables, nor constructors, only abstract methods.
These methods are assumed to be abstract and public---no need to say so explicitly.
An interface may extend any number of other interfaces.
A class that implements an interface must define all it's methods, or be abstract.
An interface may be used to type a variable or a method.
A variable typed as an interface may be given as value any instance of any class that implements that interface.
See the Interface demonstration.