Witscale Test Center

4.5 Static nested classes. > 4.5.1 Instantiation of static nested class


4.5.1 Instantiation of static nested class


The static nested class can be instantiated like any other top-level class. However, it must be referred with the enclosing class name at the time of instantiation. In Figure 4.3, the static nested class NestedOne is referred with name OuterOne.NestedOne at the time of its instantiation. Rest of the instantiation is same as any top-level class.

 

 

Figure 4.3 Instantiation of a static nested class

 

The static nested class is a static member of enclosing class. Therefore, just like other static members of class, it can be declared as public, private, protected or with default access.