Java tutorial
import java.io.Console; public class Main { public static void main(String[] args) throws Exception { Console cnsl = System.console(); // test for console not null if (cnsl != null) { // read line from the console String name = cnsl.readLine("Enter name : "); // print System.out.println("You have entered : " + name); } // flushes console and forces output to be written cnsl.flush(); } }