read string in jaava code example
Example 1: taking string input in java
Scanner in = new Scanner(System.in);
String s = in.nextLine();
Example 2: how to read input in java
//For continues reading a line
import java.util.Scanner;
Scanner in = new Scanner(System.in);
while(in.hasNextLine()) {
String line = in.nextLine();
System.out.println("Next line is is: " + line);
}