Aashish Vyas wrote:
According to my knowledge.,
Your understanding is more or less correct, but most of what you wrote is not relevant to the question at hand.
What I was getting at is this: In terms of what "static" means to us a Java programmers, it means "this thing is associated with the
class in which it's defined, not with any particular instance. The underlined point is the key.
In the first case, "Nested" is associated with the enclosing class "Outer".
In the second case, "StaticOuter" has no enclosing class with which to be associated, so calling it static or non-static is meaningless. Top-level classes don't have the property of staticness/non-staticness.