Inheritance and Polymorphism
Dive deeper into object-oriented Java with inheritance and polymorphism.
StartKey Concepts
Review core concepts you need to learn to master this subject
Inheritance in Java
Main() method in Java
super() in Java
Protected and Final keywords in Java
Polymorphism in Java
Method Overriding in Java
Child Classes in Arrays and ArrayLists
Inheritance in Java
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.
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory