Always read the API docs before using a class. The docs for Scanner say "A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace." and for the next()...