008-003-009
Call One Method from Another
Easy
Problem Description
Call One Method from Another
In this problem, read one line from standard input as a name, implement createGreeting(String name) to build and return a greeting string, and showGreeting(String name) to call it and print the result. In the main method, use Scanner to read the name and call showGreeting(name).
Input: A string representing a name (one line)
Output: One line in the format Hello, {name}!
Learning Objectives:
- Apply the procedural decomposition pattern of calling one method from another
- Understand the separation of roles between a value-returning method and a display method
- Improve code reusability and readability by splitting logic into small methods
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