Oh boy...
semantics alert :roll:
An inner class
in the narrow, JLS sense refers to a non-static nested class. Such classes always carry an implicit reference to the enclosing "outer" class.
Unfortunately, some documents use the term "inner class"
in the broad sense to indicate any type of nested class, static or not. Even more unfortunately, those documents include some coming from Sun themselves
Personally, I think the first of these definitions makes a lot more sense than the second. YMMV. Beware, in any case. I will assume the
test meant "inner class" in the narrow sense since anything else doesn't make sense.
Karin, you are right. An inner class can access instance variables in the enclosing class, private or not (and, oddly, those of other inner classes enclosed in the same class), and if the class is defined inside a method, also any final method-local variables (including but not restricted to method parameters). Of the four answers they give, B is best; C is wrong because it is too restrictive.
Don, I assume that's a typo and you meant to say "non-final" instead of "non-private".
- Peter