From the point of view of Test Nested this is just an identifier, as if it were a member, for example. Since this is public , you can access it wherever you can access any of the Outer or SubOuter . However, both methods are identical; they identify the same class.
You can even refer to each other:
Outer.Nested x = new Outer.Nested(); SubOuter.Nested y = x;
Or even
Outer.Nested x = new SubOuter.Nested(); SubOuter.Nested y = x;
However, as you can see in the debugger, x and y use the Outer.Nested link instead of SubOuter.Nested .
EDIT: as already mentioned, this is not a new feature, it is just the usual handling of members within classes. Thus, it certainly does not add any benefit to the language, since the function that you describe simply does not exist. From here follows the principle of least surprise .
The treatment of nested classes is different, however this will be a new feature.
source share