package staticnestedclasses; public class R { int y=1; static int z=2; public static class S { int x; void f () { System.out.println("f(): x=" + x); //System.out.println("f(): y=" + y); //Static reference to a non-static field System.out.println("f(): z=" + z); } static void g() { //System.out.println("g(): x=" + x); //Static reference to a non-static field // System.out.println("g(): y=" + y); //Static reference to a non-static field System.out.println("g(): z=" + z); } } }