From the course: Java 8+ Essential Training: Objects and APIs

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

About inheritance and polymorphism

About inheritance and polymorphism - Java Tutorial

From the course: Java 8+ Essential Training: Objects and APIs

Start my 1-month free trial

About inheritance and polymorphism

- [Instructor] I previously described encapsulation, but there are two other concepts that you need to master to be a great object-oriented programmer, inheritance and polymorphism. Inheritance means that there's a relationship between classes in your application that lets you inherit or extend functionality from one class to another. Not all object-oriented languages are the same. For example, C++ supports multiple inheritance, that is one class can inherit functionality from more than one other class. But in Java, there's only single inheritance, each class can extend or inherit functionality from only one other class. This actually makes it a lot easier to manage your code. If you run into a bug, that bug can either be in the class that you're working on or in its direct superclass or in its superclass and so on, but the issue has to be somewhere in that linear path. Java does allow you to implement multiple interfaces in a single class, but we'll get to interfaces later. There are…

Contents