In Java, all classes belong to one big hierarchy derived from the most basic class, called Object
. This class provides a few features common to all objects; more importantly, it makes sure that any object is an instance of the Object class, which is useful for implementing structures that can deal with any type of object. If we start a class from "scratch" the class automatically extends Object
. For example:
public class SeaCreature
{
...
}
is equivalent to:
public class SeaCreature extends Object
{
...
}
when new classes are derived from SeaCreature
, a class hierarchy is created. For example:
public class Fish extends SeaCreature
{
...
}
public class Mermaid extends SeaCreature
{
...
}
This results in the hierarchy show below.

Figure 28-1. SeaCreature
and two derived classes