Java ClassesLesson 34Free preview
Java Inheritance
This lesson is part of Java · All levels
Summary
Inheritance makes one class inherit fields and methods from another class using keyword extensions. The parent class is called the superclass and the receiving class is called the subclass. With inheritance, the code doesn't need to be rewritten and new behavior can be added to the subclass.
Key points
- Syntax: Child class extends the person {...}
- Subclass acquires field and method superclass except for private type
- Java only supports single class inheritance, but it can go through many levels.
- The method of superclass can be overridden by subclass
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.