Hi.
Well, it doesn't compile for me either, and I'm on Windows NT with jdk1.3.0_02.
The problem is that you can't refer to a static class the same way you refer to a non-static class. Static classes are ONLY allowed inside other top-level classes or interfaces. In fact, when you create a static class, it's not *really* a member of that class...at least you shouldn't think of it that way. It's certainly NOT an *inner class*, even though it is a nested class.
You refer to a static class via it's fully qualified name, which includes all the names of any classes it is enclosed by. In this case, it's only enclosed by one class, Test1, so class A's fully qualified class name is
Test1.A
(obviously if Test1 were nested within a package, that package name would be part of class A's fully qualified name).
Since class A has a default access modifier, it can be refered to by any class in the same package as Test1. If I had another class, Foo, in the same package as Test1, I would refer to class A as:
Test1.A
If I want to create a new instance of class A, I write
new Test1.A();
Think of static nested classes as just a way to extend the package naming heirarchy.
Since class A is defined within Test1, if I want to create a new instance of this class in a method of Test1, such as main above, I could simply write
new A()
because class A is visible in that scope.
What you can't do is what you tried to do above, that is, create an instance of class A via an instance of Test1.
new Test1().new A() //bad, doesn't work.
This kind of syntax would only work if A was an inner class, but it's NOT, it's a static nested class.
Hope this clears it up!
Rob