Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- class App {
- public static void makeAnimalSound(Animal animal) {
- animal.sound();
- }
- public static void main(String[] args)
- {
- Dog dog = new Dog();
- dog.sound();
- Mamal cat = new Mamal();
- dog.sound();
- makeAnimalSound(dog);
- makeAnimalSound(cat);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement