Inheritance in Java, Part 2: Object and its methods
Java's standard class library consists of thousands of classes and other reference types. Despite the differences in their capabilities, each of these types directly or indirectly extends the Object
class. Together, they form one massive inheritance hierarchy.
The first half of this tutorial introduced the basics of inheritance in Java. You learned how to use Java's extends
and super
keywords to derive a child class from a parent class, invoke parent class constructors and methods, override methods, and more. Now, we'll turn our focus to the mothership of the Java class inheritance hierarchy, java.lang.Object
.