Skip to main content

Practice · 1 of 5

Dispatch in a collection

CHALLENGE
Difficulty: intermediate+25 XP

Implement int countSpeakers(Animal[] zoo, String sound): count the animals whose speak() equals sound. Bird overrides legs too — trace which body runs for each call.

Back to lesson: Practice: Inheritance lab