014-001-009

Extending Classes with Inheritance

Easy

Problem Description

Extending Classes with inheritance

Learning Objective: Understand the basic syntax of inheritance using the extends keyword

In this problem, you will create a program that defines a Dog class inheriting from the Animal class using the extends keyword, calls the parent class's speak() method, and displays the result to standard output.

Overview

Inheritance is a mechanism that allows you to create a new class (child class) by inheriting the features of an existing class (parent class). The extends keyword is used to define the inheritance relationship.

Specifications

  1. The Animal class is defined as the parent class
  2. Create the Dog class by inheriting from the Animal class
  3. Call the parent class's speak() method from the Dog class
  4. Create a dog instance in the Main class and execute speak()

Output Format

Animal speaks

Test Cases

※ Output examples follow programming industry standards

Input:
Expected Output:
Animal speaks
Input:
Expected Output:
Animal speaks
Input:
Expected Output:
Animal speaks
Input:
Expected Output:
Animal speaks
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
Animal.java🔒
Dog.java🔒
Main.java🔒
3/6 ファイル189B
⚠️警告
  • No main method found
// === Animal.java ===
public class Animal {
}
0 B / 5 MB

You have 6 free executions remaining