> public class TestAnony {
> int memberInt = 123;
memberInt is an instance member of TestAnnoy with the default, package
private access.
> public static void main (String a[]) {
>
> new TestAnony() { // anonymouse class declaration
>
> { // instant initializer
An anonymous nested class, so no outer this. However it does extend the
TestAnnoy class and is clearly in the same package, so has access to the
public, protected and package private (like memberInt) variables of the
superclass.
> System.err.println(memberInt); // Why is this OK?
> }
[quoted text clipped - 3 lines]
> class SomeLocal { // local class declaration
> public SomeLocal() { // constructor
If you did this from a non-static method, you would rather confusingly
have two memberInt variables. Not good.
> //System.err.println(memberInt); //static Ctx. this won't work
> }
[quoted text clipped - 3 lines]
>
> }
It's probably best to avoid any even slightly confusing inheritance when
dealing with nested classes.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/