class Inner { public void doTheWork() { // print member of enclosing class System.out.println(msg); } } Inner p = new Inner(); p.doTheWork();