016-001-004

Class Basics: Self Introduction

Easy

Problem Description

class Basics: Self Introduction

In this problem, you will create a program that defines a Person class with name and age as fields, initializes them via a constructor, and displays a self-introduction message through a method to standard output.

Learning Objective: Understand basic class structure (fields, constructor, methods)

Create a Person class to manage self-introduction information. Store name and age as instance fields, initialize them through a constructor that accepts both values, and implement a method that prints the formatted self-introduction message.

Input

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

Output

Self Introduction:
Name: [name]
Age: [age]
```java

## Examples

### Example 1: Alice, 25 years old
Input:
```java
Alice
25
```java
Output:
```java
Self Introduction:
Name: Alice
Age: 25
```java

### Example 2: Bob, 30 years old
Input:
```java
Bob
30
```java
Output:
```java
Self Introduction:
Name: Bob
Age: 30
```java

### Example 3: Boundary (single char name and age 1)
Input:
```java
C
1
```java
Output:
```java
Self Introduction:
Name: C
Age: 1

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