The Power of Inheritance
You have used inheritance every time you worked with one of the standard Java classes such as String or Integer. Java classes are organized into a pyramid-shaped hierarchy of classes in which all classes descend from the Object class.
A class of objects inherits from all superclasses that are above it. To get a working idea of how this operates, consider the JApplet class. This class is a superclass of all applets, browser-based Java programs that use a graphical user interface framework called Swing. The JApplet class is a subclass of Applet.
A partial family tree of JApplet is shown in Figure 12.1. Each of the boxes is a class, and the lines connect a superclass to any subclasses below it.
Figure 12.1. The family tree ...
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.
Read now
Unlock full access