Responsive Ads Here

Wednesday, August 17, 2016

Java anonymous inner class example using interface


package Interface;

interface Eatable {
 void eat();
}

class TestAnnonymousInner1 {
 public static void main(String args[]) {
/*  Eatable e = new Eatable() {
   public void eat() {
    System.out.println("nice fruits");
   }
  };
  e.eat();
*/
  new Eatable() {
   public void eat() {
    System.out.println("nice fruits");
   }
  }.eat();
 }
}

No comments:

Post a Comment

php4

<?php    // Start the session  session_start();  ?>  <!DOCTYPE html>  <html>  <head>       <link rel=&q...