Why are local classes allowed to be declared in a static context, while member inner classes are not allowed to be declared in a static context? [ April 25, 2003: Message edited by: Marlene Miller ]
This may not help at all, since I am a newbie and studying myself. But I've always thought of public static void main(...) as a static method. In which case, static methods can only access static class variables or static inner classes (?). As for the inner class, can somebody confirm whether all inner variables (term?) within a static method is treated as a temporary static variable as well? If so then that makes sense, because the inner class within this "main" static method, will be looked as a static class.
To create an instance of Inner an instance of Test is needed. Just provide it like new Test().new Inner(); Note that within an instance method of Test the implicit this provides the necessary enclosing instance. That is, new Inner(); will compile within an instance method of Test. [ April 25, 2003: Message edited by: Jose Botella ]
Inner is like an instance variable of Test. It can only exist in the context of an instance of Test. Think of it this way... Inner has access to all the instance variables of Test. How could Inner have access to them if there was no instance of Test?