Inheritance lets us organize related classes into ordered levels of
functionality, called hierarchies.The advantage is that we write the
common code only once and reuse it in multiple classes.
■
A subclass inherits methods and fields ofits superclass.A subclass can
have only one direct superclass,but many subclasses can inherit from
a common superclass.
■
Inheritance implements the “is a”relationship between classes.Any
object ofa subclass is also an object ofthe superclass.
■
All classes inherit from the Object class.
■
To specifythatasubclassinheritsfroma superclass,the subclass ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.