Sunday, 30 October 2016

LOCAL INNER CLASSES IN JAVA

Tags

WHAT IS LOCAL INNER CLASS:         CLASS CREATED WITHIN A METHOD OF CLASS

PROGRAM TO ILLUSTRATE CONCEPT OF LOCAL INNER CLASSES

public class outer {

      int x =100;
     
      void get(){
           
            class inner{
                 
                  void display(){
                        System.out.println("x = "+x);
                  }
            }
            inner i1 = new inner();
            i1.display();
           
           
      }

      public static void main(String[] args) {
           
            outer o1 = new outer();
            o1.get();

      }

}


OUTPUT : x = 100


Enter Your Comments Below Emoticon