012-002-005
Static Method: Greeting Utility
Easy
Problem Description
static method: Greeting Utility
Learning Objective: Process text with static method
In this problem, you will create a program that reads a name from standard input, generates a greeting message using a static method, and displays two lines to standard output.
Create a utility class that generates greeting messages. Implement the static method greet(String name) to output "Hello, [name]!" followed by "Welcome!" from the received name.
Input
Line 1: Name (string)
Output
Hello, [name]!
Welcome!
Test Cases
※ Output examples follow programming industry standards
Normal case
Input:
Taro
Expected Output:
Hello, Taro! Welcome!
Normal case
Input:
Hanako
Expected Output:
Hello, Hanako! Welcome!
Your Solution
Current Mode:● My Code
Greeting.java🔒
Solution.java🔒
2/6 ファイル97B
⚠️警告
- No main method found
9
1
2
3
4
›
⌄
import java.util.Scanner;
class Greeting {
}
0 B / 5 MB
You have 10 free executions remaining
