Access the enclosing class from an inner class
public class Main { public static void main(String a[]){ new TestIt().doit(); } public void doit() { new InnerClass().sayHello(); } public void enclosingClassMethod(){ System.out.println("Hello world!"); } class InnerClass { public void sayHello() { TestIt.this.enclosingClassMethod(); } } }