001-001-007
Variable Declaration: Self-Introduction Program
Easy
Problem Description
Variable Declaration: Self-Introduction Program
Learning Objective: Understand variables as "containers" for data, and learn the basics of keyboard input and output
Create a program that displays a nice self-introduction card when you enter your name and age. Use variables to temporarily store information and use it for display.
Input
Line 1: Your name (string)
Line 2: Your age (integer)
Output
============================
Self-Introduction Card
============================
Name: [name]
Age: [age] years old
============================
Examples
Example 1: Taro's Introduction
Input:
Taro
20
Output:
============================
Self-Introduction Card
============================
Name: Taro
Age: 20 years old
============================
Example 2: Hanako's Introduction
Input:
Hanako
18
Output:
============================
Self-Introduction Card
============================
Name: Hanako
Age: 18 years old
============================
Example 3: Minimum Value Introduction
Input:
A
0
Output:
============================
Self-Introduction Card
============================
Name: A
Age: 0 years old
============================
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
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 10 free executions remaining
