// StaticFieldTested.java Copyright (c) 2005 Kari Laitinen // http://www.naturalprogramming.com // 2005-06-23 File created. // 2005-06-23 Last modification. class TestClass { static int number_of_objects_created = 0 ; public TestClass() { number_of_objects_created ++ ; } public void print() { System.out.print( "\n " + number_of_objects_created + " objects created" ) ; } } class StaticFieldTested { public static void main( String[] not_in_use ) { TestClass first_object = new TestClass() ; first_object.print() ; TestClass second_object = new TestClass() ; first_object.print() ; TestClass third_object = new TestClass() ; first_object.print() ; TestClass fourth_object = new TestClass() ; third_object.print() ; } }