This is because you are using nextLine(). Here's a quote from the API



As you can see, nextLine() doesn't return a linefeed. So you cannot parse it if it isn't there.

Regards,
Chris