SCJP题,关于inner
ttt 2002-01-30 08:50:23 Why won't the following class compile?
class A {
private int x;
public static void main(String[] args) {
new B();
}
class B {
B() {
System.out.println(x);
}
}
}
A. Class B tries to access a private variable defined in its ouer class.
B. Class A attempts to create an instance of B when there is no current instance of class A.
C. Class B's constructor must be public.
答案是B, 为什么???