public class MainClass { private int x = 0; public MainClass() { InnerOne inner = new InnerOne(); outerMethod(); } public static class InnerOne { public void innerMethod() { System.out.println("enclosing x is " + x); // Error } } }