014-001-001
Inheritance Basics: Animal Class
Easy
Problem Description
inheritance Basics: Animal class
In this problem, you will create a program that defines an Animal parent class, inherits from it using the extends keyword to create a Dog class, and displays the Dog object's information to standard output using the input name.
Learning Objective: Inherit parent class with extends
Create Animal class representing animals and Dog class inheriting from it. Use extends keyword to inherit parent class functionality.
Input
Line 1: Animal name (string)
Output
Name: [name]
Type: Dog
Sound: Woof
Examples
Example 1: Basic name
Input:
Pochi
Output:
Name: Pochi
Type: Dog
Sound: Woof
Example 2: Different name
Input:
Max
Output:
Name: Max
Type: Dog
Sound: Woof
Example 3: Boundary (1 character)
Input:
A
Output:
Name: A
Type: Dog
Sound: Woof
Test Cases
※ Output examples follow programming industry standards
Normal case
Input:
Buddy
Expected Output:
Name: Buddy Type: Dog Sound: Woof
Normal case
Input:
Shiro
Expected Output:
Name: Shiro Type: Dog Sound: Woof
Your Solution
Current Mode:● My Code
Animal.java🔒
Dog.java🔒
Solution.java🔒
3/6 ファイル161B
9
1
2
›
⌄
public class Animal {
}
0 B / 5 MB
You have 10 free executions remaining
