The Scanner class has several different hasNext... methods that allow the program to see what kind of data is available to be read. Try using some of them with the matching next... method.