class A { public static class B { public void methodB1() { System.out.println("Hello World !"); } } public void methodA1() { System.out.println("Good-bye World !"); } } public class staticInner { public static void main(String[] args) { A.B x = new A.B(); // defining variable x.methodB1(); // Invoking method } }