W.A.P to 'Print String' in Java :-



import java.util.Scanner;

public class JavaProgram
{
public static void main(String args[])
{
String str;
Scanner scan = new Scanner(System.in);
	  
System.out.print("Enter Your Name : ");
str = scan.nextLine();
	  
System.out.print("Hello, " + str);
}
}

Output:


Enter Your Name : Mayank Rana
Hello, Mayank Rana

			

Previous Next