Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.33 KB | None | 0 0
  1. package test;
  2.  
  3. class App {
  4.  
  5.     public static void makeAnimalSound(Animal animal) {
  6.         animal.sound();
  7.     }
  8.    
  9.     public static void main(String[] args)
  10.     {
  11.         Dog dog = new Dog();
  12.         dog.sound();
  13.         Mamal cat = new Mamal();
  14.         dog.sound();
  15.        
  16.         makeAnimalSound(dog);
  17.         makeAnimalSound(cat);
  18.     }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement