014-003-004
Explicit Super Constructor Call
Medium
Problem Description
Explicit Super Constructor Call
Learning Objective: Understand how to explicitly call parent class constructor using super()
Overview
Create parent class Animal and child class Dog, and explicitly call Animal's constructor from Dog's constructor.
Specifications
- Animal class: name field and constructor
- Dog class: breed field and constructor using super()
- Create Dog object and output information
Output Format
Name: Pochi
Breed: Shiba
Test Cases
※ Output examples follow programming industry standards
Input:
Expected Output:
Name: Pochi Breed: Shiba
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
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
