Another directive in the header is the .super directive which is used to indicate the superclass of the class. Every class must have a superclass; if no .super directive is given, java/lang/Object is assumed. The class java/lang/Object is special, because it doesn't have a superclass. If you have .class Bicycle .super Vehicle then we say that Vehicle is a superclass of Bicycle, and Bicycle is a subclass of Vehicle. An instance of class inherits all the fields and all the methods of the superclass. The idea is that you can use an instance of a subclass anywhere you can use an instance of the superclass. This behavior is discussed in more detail in section 4.2.2. |