public class MainClass { public static void main(String args[]) { OuterOne.InnerOne i = new OuterOne().new InnerOne(); i.innerMethod(); } } 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(); } }