011-001-006

Constructor Definition: Person Information Initialization

Easy

Problem Description

constructor Definition: Person Information Initialization

In this problem, you will create a program that implements a Person class with a constructor that accepts a name and age as arguments, initializes the object's fields with values read from standard input, and displays the result to standard output.

Learning Objective: Set object initial state with constructor

Create Person class managing person information. Receive name and age in constructor, initialize fields. Constructor has same name as class and no return type.

Input

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

Output

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

## Examples

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

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

### Example 3: Boundary values
Input:
```java
A
0
```java
Output:
```java
Name: A
Age: 0 years old

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