posted 21 years ago
Hi Marlene,
Those are good examples.
EXAMPLE 1:
Z() is an inner class so it requires an instance of the enclosing class and static methods does not have a reference to that instance
However, if the instance of the enclosing class is supplied, then the call would work:
EXAMPLE 2:
The problem with this code is that C.A() is the FQN of a member class which does not exists.
EXAMPLE 3
I always see static nested class as if it is inside a package with the outer class as its package. So that is why it can even be imported by other class. So static nested class are really like any top-level class.
I think it is not allowed to define static nested class inside a method because if it does, then it will loose some of the properties of a top-level class.
Just my $0.02.