InterviewSolution
| 1. |
What Is Static Member Class? |
|
Answer» A STATIC MEMBER class BEHAVES much like an ordinary top-level class, except that it can access the static members of the class that contains it. The static nested class can be accessed as the other static members of the enclosing class without having an instance of the OUTER class. The static class can CONTAIN non-static and static members and methods. public class InnerClass { static class StaticInner { static int i = 9; int no = 6; private void method() {} public void method1() {} static void method2() {} final void method3() {} } } The static inner class can be accessed from Outer Class in the following manner:
A static member class behaves much like an ordinary top-level class, except that it can access the static members of the class that contains it. The static nested class can be accessed as the other static members of the enclosing class without having an instance of the outer class. The static class can contain non-static and static members and methods. public class InnerClass { static class StaticInner { static int i = 9; int no = 6; private void method() {} public void method1() {} static void method2() {} final void method3() {} } } The static inner class can be accessed from Outer Class in the following manner: |
|