007-002-005

Class and Object: Pet Information

Easy

Problem Description

Class and Object: Pet Information

Learning Objective

Learn how to declare classes and create objects.

Problem

Create a program that manages pet name and age using a Pet class.

Input

Line 1: Pet name (string)
Line 2: Pet age (integer)

Output

Name: [name]
Age: [age].

Test Cases

※ Output examples follow programming industry standards

Input:
Pochi
3
Expected Output:
Name: Pochi
Age: 3
Input:
Tama
5
Expected Output:
Name: Tama
Age: 5
❌ 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