I'm unsure why this code compiles... quoting the Java tutorials:
like static class methods, a static nested class cannot refer directly to instance variables or methods defined in its enclosing class — it can use them only through an object reference.
Src: http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
public class StaticNested { private String member; private static String staticMember; static class StaticNestedClass { private void myMethod() { System.out.println(staticMember); StaticNested nested = new StaticNested(); System.out.println(nested.member); } } } I didn't expect to be able to access member directly, but the code compiles fine. Am I misunderstanding the Java spec?
Sorry about the formatting, I'm struggling with my browser + post editor.