You should read the according javadoc (for example: http://download.oracle.com/javase/1,5.0/docs/api/java/util/Scanner.html ). The Exception is raised if the input does not match the method you used to get it, for example you use getBoolen but the next value can not be translated into a boolean.