Try using the hasNextLine() method of the Scanner class instead of hasNext, see if that makes any difference.
Unless you explicitly say what's supposed to happen, and what IS happening, we would...