January 2018
Intermediate to advanced
115 pages
1h 37m
English
Inheritance allows a class to acquire the members of another class. In the following example, Apple inherits from Fruit. This is specified with the extends keyword. Fruit then becomes the superclass of Apple, which in turn becomes a subclass of Fruit. In addition to its own members, Apple gains all accessible members in Fruit, except for its constructors:
A class in Java may only inherit from one superclass, and if no class is ...