Code:
what i'm confused about is the output from these lines:
Code:
someone care to explain?
Code:
public class Test {
String instVar;
static String statVar = "A";
Test() {
System.out.println("test: " + instVar + statVar);
instVar = "B";
statVar = "C";
}
public static void main(String[] args) {
Test t1 = new Test();
t1.instVar = "D";
t1.statVar = "E";
Test t2 = new Test();
System.out.println("inst: " + t1.instVar + t2.instVar);
System.out.println("stat: " + t1.statVar + t2.statVar);
}
}
Code:
Code:
Test t2 = new Test();
System.out.println("stat: " + t1.statVar + t2.statVar);
