From the course: Java 11+ Essential Training
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
About inheritance - Java Tutorial
From the course: Java 11+ Essential Training
About inheritance
- Java is an object-oriented language, and like all such languages, it supports the concept of inheritance. Inheritance is a way of defining relationships between classes and indicating when one class should inherit functionality from another. In Java, you only have what's known as single inheritance. That means that each class can extend only one class, directly, or you can say it only has one direct superclass. That superclass can have its superclass, which can have its own, as well. So you can have a very deep inheritance hierarchy, but because you only have single inheritance, you know exactly where functionality is coming from, and it makes debugging and maintenance a lot easier. Classes can implement multiple interfaces, and we'll talk about interfaces later on, but for now, I'll confine the discussion to classes. Here's some important vocabulary around inheritance. In Object-Oriented languages, the…