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

Java: Creating and using an anonymous class

Java: Creating and using an anonymous class
{filelink=11047}

public class Person
 {
     // anonymous class
    interface Action
    	 {
          void manger();
         }
  public static void main(String[] argv)
 {
 	// using anonymous class
    Action act = new Action()
     {
      public void manger()
      {
        System.out.println("Person eats");
      }
    };
    // call anonymous class method
    act.manger();
  }
}

Users who found this page were searching for:

  • java create anonumous class

No comments yet.

Leave a Comment