public class OuterClass { private int x; public class InnerClass { public void doSomething(){ System.out.println(x); } } }