/** * This code is from the book: * Winder, R and Roberts, G (1998) * Developing Java Software</em> * John Wiley & Sons. * It is copyright (c) 1997 Russel Winder * and Graham Roberts. */ class l1Nest3{//Class4 private static int x = 10; private static String h = "hello"; private static class Nested{ public static class InnerNested{ public void f(){ System.out.println(x); System.out.println(h); System.out.println(d); } } public void f(){ System.out.println(x); System.out.println(h); } private static double d = 3.141; } public static void main(String[] args){ Nested n = new Nested(); Nested.InnerNested pn = new Nested.InnerNested(); n.f(); pn.f(); } } /******** sample compilation & run ******* # javac l1Nest3.java # java l1Nest3 10 hello 10 hello 3.141 # ******************************************/