CJCoding With Joseph
15per day

Zoo Exhibit with Abstract Animals and Feedable Interface

Build a small zoo exhibit system.

1. Create an interface Feedable with a method String food().
2. Create an abstract class ZooAnimal that implements Feedable. It has a protected String name and a constructor. It declares an abstract method String exhibit() but does NOT implement food() โ€” subclasses must implement both.
3. Create Lion extending ZooAnimal. Constructor takes name. exhibit() returns "Savanna". food() returns "meat".
4. Create Penguin extending ZooAnimal. Constructor takes name. exhibit() returns "Arctic". food() returns "fish".

Do NOT write a main method.

Expected Output:

Simba lives in Savanna and eats meat
Tux lives in Arctic and eats fish
Topics:
Abstract ClassesInterfacesInheritanceClasses
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.