Read standard input (stdin) with java.io.Console in Java

In JDK 1.6, reading standard input (stdin) changed to a simple approach using java.io.Console.

readLine takes input from FileDescriptor.in which is a handle to System.in which uses the InputStream class.

System.out.println("Enter text:");
// Note: console.readLine returns null when used from an IDE
String input = System.console().readLine();
System.out.println(input);

Using Scanner is a friendly approach when using an IDE.