Java Program For Inner Class

class Outer
{
 int outer_x =100;

 void test()
 {
 Inner inner = new Inner();
 inner.display();
 }

 class Inner
 {
   void display()
  {
  System.out.println("display: outer_x=" + outer_x);
  }

 }
}

class InnerClassDemo
{
  public static void main(String args[])
 {
 Outer outer = new Outer();
 outer.test();
 }
}
Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Web Developer, Student and Mechanical Engineer. He Enjoys writing articles, Blogging, Solving Errors and Social Networking. Feel Free to let me know any of your concerns about hacking or let me know if you need any more methods on hacking anything. Enjoy Learning

No comments:

Post a Comment