014-002-005
Implicit Super Constructor Call
Medium
Problem Description
In this problem, you will create a program that implements an Animal class and a Dog class that extends it, verifying that the superclass constructor is implicitly invoked first when a Dog object is instantiated, and displays the result to standard output.
Implicit Super constructor Call
Learning Objective: Understand how the super class constructor is implicitly called during inheritance
Overview
Create a Dog class that extends Animal and verify the constructor call order.
Specifications
- Animal class: No-argument constructor outputs "Animal created"
- Dog class: Extends Animal, constructor outputs "Dog created"
- When creating a Dog object, Animal constructor is automatically called first
Input
Dog's name is provided
Output Format
Animal created
Dog created
Name: Pochi
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up