Start learning now
You've reached Level 14!
Congratulations on your latest achievement! You've learned a lot about interfaces and abstract classes. You've completed 31 tasks. Or maybe slightly less if you saved some for later. Now is the right time to explore type casting and the instanceof operator. And to complete a big task about interfaces.
Today we'll continue getting to know the instanceof operator. You already heard about it in previous lessons. It checks whether an object is an instance of a particular class. Today you'll learn when, how, and where it can and should be used, and whether it takes into account inheritance and interfaces.
Practice with instanceof
While you were studying the instanceof operator, the guys at the secret CodeGym center were having a great time at a party. A party held in your honor, by the way. As a result, your teacher Diego isn't really in the mood to work today. He's only prepared two tasks about instanceof for you. But don't get soft. You can make it up later.
Type casting. Widening and narrowing conversions
During the first quest, you once encountered widening and narrowing primitive type conversions. Now reference types are quite familiar to you. So it's time to see widening and narrowing type conversions work for them.
Tasks about type casting
Let's convert some types! Preferably, reference types, not primitives. After all, anyone can convert primitive types after the first quest. Master Diego has prepared five tasks on this topic.
Useful links from the Professor — 14
Of course, looking at the same material from different angles is useful, because everyone thinks differently, and perhaps for you the best source of the theory will be different from the source best suited to your friend. Especially for you, the Professor found a very interesting lesson on type casting and instanceof.
Bonus task | Lesson 6 | Level 4
Welcome to the international chicken farm! What? Nothing is ready! Then our plans have changed. Since it's not already here, we'll create the chicken farm. It will accommodate chickens of different nationalities, derived from some abstract Hen class, with methods that will return the number of eggs laid per month.
Unboxing a quantum computer
We have this tradition at CodeGym: near the end of each level, your teacher Julio invites you to watch a fascinating IT video. Sit back and relax. You'll learn something new and even get some dark matter... Today we’ll visit D-Wave Systems, the world's first quantum computing company. Its systems are widely used by Google, NASA, Volkswagen, and others.
Bonus task | Lesson 8 | Level 4
Captain Squirrels is on the phone! He has a couple of surprises for you. More precisely, not a couple, and they aren't surprises, but rather ten tasks to reinforce your knowledge. And the truly curious can try their hand on three bonus tasks that are more difficult. For example, in one of them you'll encounter the singleton pattern.