how to read input from the console in java code example
Example 1: java text ouput to console
System.out.println("Hello world!");
//This will be printed out to the console and requires no imports.
Example 2: java taking console input
String str = System.console().readLine();
Example 3: 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);
}