public class MainClass {
public static void main(String[] argv) {
new OuterOne();
System.out.println();
}
}
class OuterOne {
private int x = 0;
public OuterOne() {
InnerOne inner = new InnerOne();
outerMethod();
}
public class InnerOne {
private int x = 1;
public void innerMethod() {
System.out.println("enclosing x is " + x);
}
}
public void outerMethod() {
System.out.println("x is " + x);
}
public void makeInner() {
InnerOne anInner = new InnerOne();
anInner.innerMethod();
}
}
|