class ObjX { int i; void print () { System.out.println ("i=" + i); } } //end-ObjX public class DynamicExample3 { public static void main (String[] argv) { // Create an instance and do stuff with it. ObjX x = new ObjX (); x.i = 5; x.print(); // Create another instance assigned to the same variable. x = new ObjX (); x.i = 6; x.print(); } }