public class MainClass { private int x; public class InnerOne { private int y; public void innerMethod() { System.out.println("y is " + y); } } public void outerMethod() { System.out.println("x is " + x); } // other methods... }