//******************************************************************** // MyClass.java Author: Lewis and Loftus // // Demonstrates the use of the static modifier. //******************************************************************** class MyClass { private static int count = 0; //----------------------------------------------------------------- // Counts the number of instances created. //----------------------------------------------------------------- public MyClass () { count++; } //----------------------------------------------------------------- // Returns the number of instances of this class that have been // created. //----------------------------------------------------------------- public static int getCount () { return count; } }