java get user input in console code example
Example 1: java taking console input
String str = System.console().readLine();
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);
}