Start learning now
You've reached Level 13!
Congratulations, you've completed the second level of the quest! You've played around with abstract classes and interfaces. You've learned what polymorphism is, and how and why you overload methods. On the third level, we'll continue in the same vein as you deepen your understanding of polymorphism and interfaces.
Interfaces exist to support specific behavior
An interface is a mechanism for one thing to interact with something else. For example, a person tells a dog to "sit", i.e. gives a command that is part of the dog's "voice control interface". If the dog executes the command, then it supports this interface. The same is true in programming. We can combine methods (actions performed on an object) and its data to form an interface. Why? You'll learn how in the lesson.
Interface tasks | Level 3
Combining methods into an interface is for grownups. This is a big step for you! And to remove all doubt, and to immediately help you start feeling comfortable using this powerful weapon, you'll get ten interface-related tasks all at once. We promise: it won't be boring!
How to use abstract classes
It's time to dive deeper with abstract classes. A "regular" class is a model of some entity. That's clear enough. An abstract class contains methods that have not been implemented, but it can contain methods that have been implemented. Any real-world analogues? You'll learn in the lesson.
Practice with abstract classes | Level 3
Diego the Robot is absolutely in love with everything abstract, including abstract classes. He's trying to instill this love in you as well. In this lesson, you'll receive four doses of love in the form of knowledge-reinforcing tasks about abstract classes.
Inheriting multiple interfaces
People say there is no multiple inheritance in Java... It doesn't seem to be there, but it actually does exist. There is no multiple inheritance of classes due to certain problems (we'll talk about them later). But multiple inheritance of interfaces is quite possible in Java, and this interesting and powerful tool will really help you write rational code.
Practice with abstract classes
In this task, we need to use multiple inheritance to model the "Tom and Jerry" cartoon! To do this, we create Dog, Cat and Mouse classes, and implement interfaces in them. The cat can move, eat, and be eaten. The mouse can move and be eaten. The dog can move and eat.
Abstract class vs. interface
How does an abstract class differ from an interface? These concepts will very soon become second-nature and understandable, but it isn't always easy to keep them separate while you learn. Your teacher Bilaabo comes to the rescue with his magical table of comparisons of abstract classes and interfaces.
Standard interfaces: InputStream, OutputStream
Once upon a time there were InputStream and OutputStream. They are declared as abstract classes. But if you look closely, they're quite real interfaces. Almost all of their methods are abstract, except for a few insignificant methods. So, here's the question: What makes them special? And why did they make them abstract classes anyway?
Useful links from the Professor — 13
Even fascinating practical training involves independent work. Of course, looking at the same material from different angles is very 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. This lesson includes a link to an excellent article about interfaces.
Steve Wozniak — Apple founder
You need a proper rest before the difficult tasks at the end of the level. This time we'll watch a video about some kids who built one very beautiful computer in a garage. And then another. And one more. And their names were Steve and Steve. Jobs and Wozniak.
Bonus task | Lesson 11 | Level 3
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 of abstract classes and interfaces. And the truly curious can try their hand on three bonus tasks. You'll really have to put on your thinking cap to complete these tasks.