The Java language enables you to define a class inside another class. Such a class is defined as Nested Class or Local Inner class. The Nested Class are classified into -
1)Static Nested Inner class are declared static called static Nested classes.
2)Non-Static Nested classes are those classes that are not defined static. This class is defined also as Inner class.
The Inner class is defined as local Inner class when you declare a inner class within the body of method.
Understand with Example
The Tutorial illustrates an example from Local Inner class. The code include a Outer class Inner class include a method that add the integer into the array. The println print the even indices of the array. The inner class Get Even Integer is same as Java iterators,The work of Get Even Integer are used to step through a Inner class, This method used in GetBig Integer is used to retrieve the last element, the current element and the last element. The main method that instantiate a Inner Class object and this is used to fill the array Of Ints array with the specified value, This call a print even method and print the required even output in ascending order.
Here is the code:
Output will be displayed as:
Ask your questions, our development team will try to give answers to your questions.