Given a string name, e.g. "Bob", return a greeting of the form "Hello Bob!".

Check below code:

package com.test.strings;

public class HelloName 
{
	public static void main(String args[])
	{
		HelloName hn = new HelloName();
		System.out.println(hn.helloName("Ram"));
		System.out.println(hn.helloName("Sham"));
		System.out.println(hn.helloName("X"));
	}
	
	public String helloName(String name) 
	{
		 return "Hello " + name + "!";
	}
}

Output

Hello Ram!
Hello Sham!
Hello X!