9. Inheritance and Interfaces
In this chapter we explore inheritance. In Java (and many other programming languages), a class may be declared as a subclass of another class, in which case it inherits the properties and methods of that class. We call the original class the super-class or base class, and the subclass is called the derived class. In Java, this relationship is descibed with the extends keyword.
An interface can be thought of as a special type of base class, where public methods are declared, but not defined (i.e. methods have names and signatures, but no actual implementations).
The keywords extends and implements express the “is a” relation. In the following examples:
Student extends Personmeans: “a Student is a Person”Rectangle implements Shapemeans: “a Rectangle is a Shape”