0 votes
in JAVA by
How to read a string in java?

1 Answer

0 votes
by

How to read a string in java?

Scanner sc= new Scanner(System.in); //System.in is a standard input stream.

System.out.print(""Enter a string: "");

String str= sc.nextLine(); //reads string.

🔗Source: stackoverflow.com

🔗Source: Java Interview Questions and Answers

Related questions

0 votes
asked Oct 18, 2020 in JAVA by sharadyadav1986
0 votes
asked May 2, 2021 in JAVA by sharadyadav1986
...