Kotlinlearncs.online LogoJava
Return to List

Solve: Pet Whisperer

Created By: Geoffrey Challen
/ Version: 2020.10.0

Define a method named whisper. whisper should accept a single Pet instance and return a String?. If the pet is:

  • a Cat you should return the result of calling meow()
  • a Dog you should return the result of calling woof()
  • a Snake you should return the result of calling hiss()
  • otherwise return null.

Related Lessons

Stuck? You may find these lessons helpful: