Listing 1. The controlling class. |
---|
public class InnerClasses07{ static long baseTime = new Date().getTime(); public static void main(String[] args){ new A().meth(); }//end main }//end class InnerClasses07 |
baseTime is initialized with the current date and time in milliseconds.
baseTime is used later as a base
main instantiates a new object of class A and invokes meth on that object.
meth sequentially instantiates two separate objects of local
class B.
Then meth invokes showB on each of those
objects,
Listing 2 shows the top-level class named X.
Class A extends this class to illustrate the difference between the inheritance hierarchy and the containment hierarchy.
Listing 2. The top-level class named X. |
---|
class X{ protected int xVar = 1000; }//end class X |