Visitors

  • 7
  • Locked
A group of tourists from Planet Tally visited a Terranian zoo. But all of the animals' nameplates had been stolen by robots who needed the metal for medication. We'll forgive the robots, but now we need to write a method that determines the type of objects passed to it (cat, lion, tiger, bull, cow, or generic animal).
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Trevor
Level 23 , Phoenix, United States
24 December 2019, 04:19
This is probably the 4th problem that asks us to determine the type of the object. Pointless.
Adnan Razzaq
Level 15 , Bamberg, Germany
7 September 2019, 19:01
hello. I solved it by just changing tho positions of if statements and I m not sure why this happened. Can someone please explain this to me.
Devonte A
Level 18 , Rubery, United Kingdom
29 June 2020, 20:06
I think because instanceof will check the parent class first. So you must check the subtypes initially then the parent. Someone else may be able to elaborate.