In a study guide, I met the following question:-
package foo;
public class Outer {
public static class Inner {
}
}
Which statements are true?
A.An instance of the Inner class can be constructed with �new Outer.Inner()�
B.An instance of the Inner class cannot be constructed outside the package foo.
C.An instance of the inner class can only be constructed from within the outer class.
D.From within the package bar, an instance of the inner class can be constructed with the �new Inner()�
Answer: A
I tried the following code:-
import foo.Outer;
import static foo.Outer.Inner;
public class
Test {
public static void main (
String args []) {
new Inner();
}
}
and it worked, which suggests that the answer �D� could be correct too.