CodeGym/Java Course/Java Core/Practice with instanceof

Practice with instanceof

Available

"Hello, Amigo! You're a great friend! The professor said to come up with 10 tasks, but I'll give you just two. That's the most I could think of with a hangover. It's a shame you missed the party held in your honor yesterday. It was a great time."

4
Task
Java Core,  level 4lesson 2
Locked
Bingo!
A tiger is a bit more than a cat. And a cat is a pet. And in turn, any pet is an animal. And all of them descend from Object. Something is wrong with the inheritance in our program. Correct the 'Object animal = new Pet();' line in the main method so that the program displays "Bingo!"
4
Task
Java Core,  level 4lesson 2
Locked
Bingo!
A rose by any other name: it's no coincidence that the famous cartoon cat is called Tom. In the language of Shakespeare, a tomcat is a male cat. Obviously, tomcat is also a "regular" cat and can move. Correct the program so that the variable cat references an object that simultaneously implements CanMove, and is a Cat and a Tomcat.
Comments (12)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Alexandre Lalancette
Level 41 , Quebec, Canada
13 November 2019, 14:43
What can I do with all the dark matter I have? I have 680
Robert Constantinescu
Level 25 , Bucharest, Romania
16 November 2019, 11:50
you'll need it for the next levels
Angel Li
Level 18 , Fremont, United States
3 July 2020, 19:14
How do you have 680????? I only have 263 now :((( even though I did most of the tasks.
Karas Backend Developer
24 November 2020, 01:03
May be he has been also implementing the additional games? you know... mine sweep and snake etc.
Oliver Heintz
Level 18 , Mustang, United States
4 December 2020, 16:59
How far along in the course do you need to be before we should be expected to be able to program those games?
PeterC Android Developer
27 December 2021, 20:04
I have 1400 already.
PeterC Android Developer
27 December 2021, 20:05
You can start the first levels of each game pretty early. And you can finish them when you gain more knowledge.
Nikolaos
Level 22 , Vrontados, Greece
18 September 2019, 10:20
That was easy! ^_^
5 August 2019, 22:05
Good to see you, Diego but I was kinda expecting to see Ellie on this one
Almaz Temirkanov
Level 24 , Bishkek, Kyrgyzstan
5 August 2019, 05:07
#2 Cat cat = new TomCat();
Almaz Temirkanov
Level 24 , Bishkek, Kyrgyzstan
5 August 2019, 04:16
#1 Object animal = new Tiger();
Ewerton Backend Developer
1 July 2019, 01:40
Well, moving on then.