014-002-005

Implicit Super Constructor Call

Medium

Problem Description

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

Test Cases

※ Output examples follow programming industry standards

Input:
Pochi
Expected Output:
Animal created
Dog created
Name: Pochi
Input:
Max
Expected Output:
Animal created
Dog created
Name: Max
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 9 free executions remaining