I tried the java.io.Console
API using eclipse. My sample code follows.
package app;
import java.io.Console;
public class MainClass {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Console console = System.console();
console.printf("Hello, world!!");
}
}
When I tried running the example, I got the following error.
Exception in thread "main" java.lang.NullPointerException at app.MainClass.main(MainClass.java:11)
Where did I go wrong? Thanks.