1 package test4; 2 3 public class NestedClass { 4 public S.S2 s2; 5 public class N { toString()6 public String toString() { return "N"; } 7 } 8 public static class S { toString()9 public String toString() { return "S"; } 10 public static class S2 { toString()11 public String toString() { return "S2"; } 12 } 13 } foo()14 public Object foo() { 15 class In { 16 public String toString() { return "S"; } 17 public String toString2() { return new S().toString(); } 18 } 19 return new Object() { 20 public String toString() { 21 return new Object() { 22 public String toString() { 23 return "ok"; 24 } 25 }.toString(); 26 } 27 }; 28 } 29 } 30