007-002-007

Class and Object: Person Info Class

Easy

Problem Description

Class and Object: Person Info Class

Learning Objective: Declare class and create object

Create Person class with name and age, create object and display information. Implement constructor and methods.

Input

Line 1: Name (string)
Line 2: Age (integer)

Output

Name: [name]
Age: [age] years old
```java

## Examples

### Example 1: Taro age 20
Input:
```java
Taro
20
```java
Output:
```java
Name: Taro
Age: 20 years old
```java

### Example 2: Hanako age 25
Input:
```java
Hanako
25
```java
Output:
```java
Name: Hanako
Age: 25 years old
```java

### Example 3: Minimum value (boundary)
Input:
```java
A
0
```java
Output:
```java
Name: A
Age: 0 years old

Test Cases

※ Output examples follow programming industry standards

Input:
Taro
20
Expected Output:
Name: Taro
Age: 20 years old
Input:
Hanako
25
Expected Output:
Name: Hanako
Age: 25 years old
Input:
A
0
Expected Output:
Name: A
Age: 0 years old
❌ 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