008-001-005

Method Definition: Greeting Method

Easy

Problem Description

method Definition: Greeting method

Learning Objective: Define and call simple method

In this problem, you will create a program that reads a name from standard input, defines a greet method, and calls it to display a greeting message to standard output.

The greet method takes a String argument (the name) and prints a greeting in the format Hello, [name]!. Call greet from the main method.

Input

Line 1: Name (string)

Output

Hello, [name]!

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