Class java.lang.Object is the root of the class hierarchy.
Every class has Object as a superclass.
The Object class is beneficial if you want to refer to any object whose type you do not know yet.
For example, there is a getObject() method that returns an object, but it can be of any type like Employee , Student , etc.
We can then use the Object class to refer to that object.
The Object class provides some common behaviors to all the objects; e.g., object can be compared, object can be cloned, object can be notified, etc.
|
|
|