How to enter the value of String in java

//How to enter the value of String in java


import java.util.*;
public class M
{
public static void main(String args[])
{
String str;
System.out.println("Enter the value of string : ");
Scanner sc=new Scanner(System.in);
str=sc.nextLine();
System.out.println("You entered : "+str);
}
}


OUTPUT:
Enter the value of string :
Hello World!!!!
You entered : Hello World!!!!

No comments:

Post a Comment