Question 235, as stated, is not correct. It reads:
(#235) TRUE or FALSE: a static inner class (considered a
top-level nested class) can NOT access non-static variables
of the outer class.
The desired answer is TRUE, but in practice, is false.
The following code shows how, with Outer being the outer
class, three being the non-static variable, and Inner
being the static inner class:
public class Outer {
protected static Outer self = null;
protected int three = 3;
public Outer() {
self = this;
Inner.doIt();
}
protected static class Inner {
protected static void doIt() {
if (Outer.self != null) {
System.out.println(Outer.self.three);
}
}
}
}