009-002-002
public Modifier: Greeting Function
Easy
Problem Description
public Modifier: Greeting Function
Learning Objective: Provide externally accessible functions with public methods
In this problem, you will create a program that reads a name from standard input, implements a greet method with the public modifier in a class, and displays a greeting message to standard output.
Implement a public void greet(String name) method in a Greeter class and call it from the main method to produce the output.
Input
Line 1: Name (string)
Output
Hello, [name]!
Let's do our best today!
Test Cases
※ Output examples follow programming industry standards
Input:
Taro
Expected Output:
Hello, Taro! Let's do our best today!
Input:
Hanako
Expected Output:
Hello, Hanako! Let's do our best today!
Input:
A
Expected Output:
Hello, A! Let's do our best today!
Input:
Bob
Expected Output:
Hello, Bob! Let's do our best today!
❌ Some tests failed
Your Solution
Current Mode:● My Code
Greeter.java🔒
Solution.java🔒
2/6 ファイル0B
⚠️警告
- No main method found
9
1
›
0 B / 5 MB
You have 9 free executions remaining
