Ok, let's look at these one at a time. First this one:
Instances of inner classes have an associated enclosing object, which is an instance of the enclosing class. However, Outer2 is a top-level class, so it doesn't have an enclosing class. So there also can't be an enclosing object, which is necessary for Inner1, because it's an inner class.
So this doesn't work: you can't subclass an inner class with a top-level class.
The second problem:
I checked this again, but this also does not work! So my second example was wrong.
The enclosing instance of an instance of Outer1.Inner1 must ofcourse be an Outer1 object. Class InnerTest1 isn't related (via inheritance) to Outer1, so this doesn't work. If you make InnerTest1 extend Outer1, then it works:
You can find all the details about inner classes in section 8.1.3 of The Java Language Specification. [ September 14, 2007: Message edited by: Jesper Young ]