Read the API for scanner, I'll quote a portion of the hasNext method for you:

Have you tried any other methods described in the API?
Scanner (Java Platform SE 6)