8 public StaticTester() {}
12 static void increment() { StaticTester.i++; }
14 public Incrementable() {}
17 public class StaticTest{
21 public static void main(String[] st) {
22 //StaticTester.i = 47;
23 StaticTester st1 = new StaticTester();
24 StaticTester st2 = new StaticTester();
25 System.printString("static i: "+StaticTester.i+"\n");
26 System.printString("st1 i: "+st1.i+"\n");
27 System.printString("st2 i: "+st2.i+"\n");
29 Incrementable incr = new Incrementable();
31 System.printString("static i: "+StaticTester.i+"\n");
32 System.printString("st1 i: "+st1.i+"\n");
33 System.printString("st2 i: "+st2.i+"\n");
35 Incrementable.increment();
36 System.printString("static i: "+StaticTester.i+"\n");
37 System.printString("st1 i: "+st1.i+"\n");
38 System.printString("st2 i: "+st2.i+"\n");