Tag

inner class in java

Browsing

Introduction Java is known for its exemplary features and Java inner class is one of them. Although variables, methods and constructors are usual members of a class, it is also possible to have another class declared inside a primary class, which is essentially a Java inner class. The scope of an inner class is limited to the scope of its outer class. For instance, if class B is defined inside class A, then class B cannot exist as itself outside class A. Inner classes were introduced back when Java 1.1 was rolled out. Following is the simple Syntax of a Java inner class: 1. class classA 2. { 3. //other members of class A defined here. 4. class classB 5.      { 6.        // members of class B defined here. 7.      } 8.  } Java inner class is one of the most well-regarded features…