Key Concepts

Review core concepts you need to learn to master this subject

Inheritance in Java

// Parent Class class Animal { // Animal class members } // Child Class class Dog extends Animal { // Dog inherits traits from Animal // additional Dog class members }

Inheritance is an important feature of object-oriented programming in Java. It allows for one class (child class) to inherit the fields and methods of another class (parent class). For instance, we might want a child class Dog to inherent traits from a more general parent class Animal.

When defining a child class in Java, we use the keyword extends to inherit from a parent class.

Inheritance and Polymorphism
Lesson 1 of 1

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo