Creating Child Classes from an Abstract Class

Learn how to create a child class from an abstract class.

Since we can’t create objects from abstract classes, we need to create child classes that inherit the abstract class code. Child classes of abstract classes are also formed with the help of the extends keyword. They’re only different in that they have to add the bodies to the abstract methods.

Note: The child classes that inherit from abstract classes must add bodies to the abstract methods.

Creating a child class named Honda

Let’s create a child class named Honda and define an abstract method that it inherits from the parent class calcNumMilesOnFullTank().

Get hands-on with 1200+ tech skills courses.