Task 4 of 5 · 0 solved · 5 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

7.5 Type checks and casting — fetch from the dogs

Total: 0 / 3 pts
Practice mode — check each part and get hints as you go.
Task

Fill in allFetches so that it returns the fetch() text of every dog in the array, one per line. Cats are skipped — they have no such method.

The program prints two lines: Rex fetches the ball and Bo fetches the ball.

Check before casting: a cat cast to Dog would crash the program.

Your solution