When I don't understand the use of a class in the standard library, the first thing I do is see if Sun had the wisdom to provide a tutorial, site:java.sun.com java.io.Console tutorial. In this case, they have
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
System.console() will return null if no console is available, and that is always the case if started using javaw or from most IDEs. Therefore, always perform the check against null.