Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package polymophism;
  2.  
  3. public interface Action {
  4.     public void eat();
  5.  
  6. }
  7.  
  8. public class Tester {
  9.  
  10.     public static void main(String[] args) {
  11.         Action m = new Man();
  12.         Human hm = new Man();
  13.         Tester tester = new Tester();
  14.         tester.eat(m);
  15.         tester.eat(hm);
  16.     }
  17.  
  18.     private void eat(Action m) {
  19.         m.eat();
  20.     }
  21.  
  22.     private void eat(Human m) {
  23.         m.eat();
  24.     }
  25. }