Inner Classes:- class inside class or interface called inner class or nested class. Advantage of inner classes is grouping multiple classes and interfaces into a single class. Another big advantage of inner class is that inner class can happily access all the data or variables of outer class directly. Types of Nested classes:- There are two types of nested classes static and non-static nested classes. (A)Non –static inner classes:- 1) Member inner class 2) Anonymous inner class 3) Local inner class (B)Static nested class Example1:-Outer.java class Outer { class Inner { void disp() { System.out.println("Hello This is Inner class Method"); } } public static void main(String[]args) { Inner in=new Inner(); in.disp(); } } Output:- C:\JAVATECH>javac Outer.java Outer.java:12: error: non-static variable this cannot be referenced from a static context Inner in=new Inner(); ...
java programming for beginners. java programming pdf, java programming software, java programming language tutorial, java programming basics, java programming books, java tutorial, learn java