014-001-004
Inheritance Basics: Animal Sounds
Medium
Problem Description
inheritance Basics: Animal Sounds
Learning Objective: Understand class inheritance
In this problem, you will create a program that defines a Dog class inheriting from the Animal class, reads an animal name from standard input, and displays the name and sound (Woof!) to standard output.
Create a Dog class that extends Animal, overriding the sound method in Dog to return "Woof!", then print the name and sound.
Input
Line 1: Animal name (string)
Output
Name: [name]
Sound: Woof!
```java
## Example
Input:
```java
Pochi
```java
Output:
```java
Name: Pochi
Sound: Woof!
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