Why instantiation of static nested class object is allowed?

Posted by Parag Meshram on Stack Overflow See other posts from Stack Overflow or by Parag Meshram
Published on 2012-10-11T09:34:35Z Indexed on 2012/10/11 9:36 UTC
Read the original article Hit count: 402

Filed under:

I have started learning Java language for Android Application developement.

As per my understanding based on static class, we cannot instantiate object of static class.

But why instantiation of static nested class object is allowed in following situaltion?

class EnclosingClass 
{     
      //...     
      class static StaticInnerClass 
      {         
          //...     
      } 
} 

Why we can create object of inner class if it is marked as static?

EnclosingClass.StaticInnerClass s = new EnclosingClass.StaticInnerClass()

© Stack Overflow or respective owner

Related posts about java