Greet the User
Easyjava
Read a single line containing a person's name and print a greeting.
Input: one line — the name (it may contain spaces).
Output: one line: Hello, <name>!
Example 1
Input
Aditi
Output
Hello, Aditi!
- The name is on one line.
- 1 <= length of name <= 40
Hint 1
Read the whole line with sc.nextLine().
Hint 2
Build the output with string concatenation: "Hello, " + name + "!".
Read the line, trim surrounding spaces, then print "Hello, " + name + "!". This is the classic "read input, use it in output" first program.