The underlying reason is that you can call a static member/method either on the class name MyClass.someStaticField
or on an instance of the class new MyClass().someStaticField
.
So as long as this is "available", MyClass.someStaticField
is equivalent to this.someStaticField
.
In your case, you always call this
from instance methods so it does exist and the statement compile.
And finally, inner classes (non-static nested classes) contain a reference to their enclosing class, which allows OuterClass.this.count
to compile too.