Inheritance is only the start of the story. Object hierarchies is how many modern languages achieve their power. Java has a very structured object hierarchy and is worth spending a little time over. Conceptually a object hierarchy is simply a tree structure of classes which get more abstract the further you go up the tree. The root of the tree, therefore, must be the most abstract while the leaves must be the most concrete. The terms abstract and concrete. The more abstract a class is, the further away it is from reality. Some classes are only created in order to be inherited from. These classes are usually very abstract and do not hold any real detail, in fact they are so abstract that java allows you to call these classes abstract. An abstract class can not be instantiated, only inherited from. That is you can not create objects from an abstract class. Our TaxCalculator would be an abstract class as it is of little use unless you extend it.

The root of the java object hierarchy is the class Object. This may seem odd and pointless but it does provide immense power. All classes in java extend the class object or have class Object at the root of their class hierarchies.

Above the hierarchy tree for our TaxCalculator. Java’s API has a very large object hierarchy which can be see if you view the API specifications online at www.java.sun.com.