If a class cannot be static how can an inner class alone be static ?

Questions by gova007

Showing Answers 1 - 3 of 3 Answers

suvojyotysaha

  • Apr 23rd, 2012
 

First ask yourself the question as to why is static used? Static helps us use those static members of the class directly, without creating an object.

Second of all the outer classes are already perceived by the JVM so is there any need for the static modifier?

Third of all there is nothing called as a static class. The static modifier just helps us access the class without creating an instance of the outer class, just like static methods. A static inner class is just like a static member of the outer class.

Due to following reason static inner classes aren't inner classes at all. They do not exhibit the property of the inner classes as they don't have access to the instance variables and non-static methods of the outer class.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions