Implicit Default Constructor Call
Problem Description
Implicit Default constructor Call
In this problem, you will create a program that implements inheritance with Pet as the parent class and Dog as the child class, demonstrating how the parent's default constructor is implicitly called from the child constructor, and displays the result to standard output.
Learning Objective: Understand implicit super() call
Create a pet management system. Define a Pet class with a name field and a default constructor, then implement a Dog class that extends Pet. Read a name from Scanner and pass it to the Dog constructor. Even without an explicit super() call in Dog's constructor, verify that Java automatically invokes the parent's default constructor first.
Input
Line 1: The pet's name (String)
Output
===== Constructor Call Order =====
Pet default constructor called
Dog constructor called
Pet: <name>
=================================
Input Example
Pochi
Output Example
===== Constructor Call Order =====
Pet default constructor called
Dog constructor called
Pet: Pochi
=================================
Test Cases
※ Output examples follow programming industry standards
Luna
===== Constructor Call Order ===== Pet default constructor called Dog constructor called Pet: Luna =================================
Max
===== Constructor Call Order ===== Pet default constructor called Dog constructor called Pet: Max =================================
Your Solution
You have 10 free executions remaining
