The Object Class

The Java-supplied java.lang.Object class is the parent or root of all classes. Every class either directly or indirectly is a subclass of the Object class. Whenever we create a class such as

class MyClass {
...
}


this is implicitly equivalent to

class MyClass extends Object {
...
}


The Object class contains a number of methods that all classes inherit by default. In many cases, we will need to override these methods within our own classes.

No comments:

Post a Comment