// iv2 class Test { int x; int y = x; Test(int x) { this.x = x; } void print1() { System.out.println("IV x: " + x); System.out.println("IV y: " + y); } void print2() { int x; // x is local -- has no default value! // int y=x; // can't use y until x has a value System.out.println("IV x: " + this.x); // IV x // can't access variables until they have values // System.out.println("IV x: " + x); // local x // System.out.println("IV y: " + y); // local y } void print3() { int x=y; System.out.println("IV y: " + y); System.out.println("IV y: " + this.y); int y=x; System.out.println("IV y: " + y); System.out.println("IV y: " + this.y); } } public class iv2 { public static void main(String[] args) { Test t = new Test(1); t.print1(); t.print2(); t.print3(); } }