Hello Vishal,
Well here are the answers to ur queries:
static class Nested
U have declared the class Nested as an inner class alright...but u have also declared it as static.
A static class member does not need any object to be instantiated.
new Test038().new Nested().method("first"); //1
Above, u r instantiating the static class Nested by using the new operator (new Nested()) and hence the error at //1
new Test038().Nested.method("second"); //2
Above, u are again instantiating the base or parent class by using the new operator (new Test038()) and hence the error at //2
Test038.Nested.method("third"); //3
Above, u r using the correct way of accessing an inner static class from an outer class and hence no error at //3.
Hope this clears ur doubts !!
Tell me if I was wrong anywhere !!