[This is a response to the first post - I only saw the second after I wrote this.]
Because Y is a nonstatic member of X, you need to create an X instance before you can create a Y instance. And since X is a nonstatic member of XY, you need an instance of XY before you can create an instance of X. (Remember, you're starting from main(), which is static and has no instances of anything to begin with.) So, replace
<code><pre>
X.Y xy = new X.Y();
</pre></code>
with
<code><pre>
XY xy = new XY();
X x = xy.new X();
X.Y y = x.new Y();
</pre></code>
or more compactly
<code><pre>
X.Y y = new XY().new X().new Y();
</pre></code>
Note that since your original variable "xy" was really a Y instance, I renamed it to "y" to avoid confusing it with the real class XY, whose instance was more deserving of the name "xy".
I assume this is just a learning example. From a class design perspective, it's pretty atrocious of course - if you want to be able to create instances of a class from a static context (the main method), you probably shouldn't declare that class to be a nonstatic member of another class.
In fact nonstatic member classes are of limited use for precisely this reason - usually a static member class would be preferable, unless you find you
need access to an enclosing instance, which you get with a nonstatic member class.
[This message has been edited by Jim Yingst (edited July 27, 2001).]