class MyClass { static int referenceCount = 0; public MyClass() { referenceCount++; } protected void fly() { ; } static int getRefCount() { return referenceCount; } } class MySubclass extends MyClass { MySubclass() { referenceCount++; } } public class MainClass { public static void main(String args[]) { System.out.print("Before: " + MyClass.referenceCount); MySubclass florence = new MySubclass(); System.out.println(" After: " + MyClass.referenceCount); florence.fly(); } }