public class MyClass {
public int myclassMember=NestedClass.nestedclassMember; //Compiler error,static reference to a non-static field
public static class NestedClass {
public int nestedclassMember=myclassMember; //Compiler error,static reference to a non-static field.
public NestedClass() {
}
}
}
但同时,以下是完全合法的,当然,在消除编译时错误之后 - :
MyClass.NestedClass nestedInstance= new MyClass.NestedClass();
什么给了?类如何同时是静态和非静态的?