Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: How to access inner class from outside

Java: How to access inner class from outside
{filelink=11049}

public class ClasseMyInnerMyOuter
{
    public static void main(String[] args)
    {
        MyOuter inner_obj = new MyOuter();
        // access inner class method
        inner_obj.new MyInner().msg();
    }
}
class MyOuter              // Outer class
{
    public class MyInner   // inner class
    	{
    	// inner class method
        public void msg()
        {
          System.out.println("Message from Inner");
        }
    }
}

Users who found this page were searching for:

  • somme en java mit current

No comments yet.

Leave a Comment