Inheritance
Introduction
Lab Overview
Learning Objective
Instructions
Child Class
Parent Class
Begin
Step 1: Create a Java project named “inheritanceDemo.”
Step 2: Create a class named Doctor, and add the code below.
Step 3: Create a class named Surgeon, and add the code below.
Step 4: Create a class named Hospital. In this class, we will create a main() method.
The project hierarchy will look like this:
Step 5: Run your Java Project.
Output on Console:
Last updated