The Java language API between des a special class named object that is the root
Class of the entire Java hierarchy. The object class, found in the Java. lang package,
Is the parent of every Java class, either directly (meaning the class is
Immediate Child of object) or indirectly (meaning object is an ancestor further
Up the inheritance tree ).
For example, consider the following employee class that does not declare
Parent class.
Public class employee
{
// Class definition
}
Because this employee does not explicitly extend another class, it implicitly
Extends object. In fact, we cocould have added the extends keyword as follows:
Public class employee extends object
{
// Class definition
}
If you write a class and do not explain itly extend another class,
Compiler adds "extends object" to your class declaration. if you write
Class that extends another class besides object, the class still is a child
Object, since eventually one of its ancestors must have extended object.
Suppose that a salary class is written that extends employee:
Public class salary extends employee
{
// Class definition
}
The salary class extends employee, and because a Java class can only have
One parent class, salary does not extend object directly. Because Employee
Extends object, however, the salary class is an indirect child of the object class.
Note that the compiler does not add "extends object" to a Child class that
Already extends another class.