How is it that for a scanner object the hasNextLine() method returns true while the hasNext() method returns false?
Not
The Basic concept of hasNext() and hasNextLine() is
hasNextLine:- Returns true if there is another line in the input of this scanner. This method may block while waiting for input. The scanner does not advance past any input.
Returns: true if and only if this scanner has another line of input Throws: IllegalStateException - if this scanner is closed
hasNext
Returns true if the next complete token matches the specified pattern.
A complete token is prefixed and postfixed by input that matches the delimiter pattern. This method may block while waiting for input. The scanner does not advance past any input.
Parameters: pattern - the pattern to scan for
Returns: true if and only if this scanner has another token matching the specified pattern
Since your last input saying true for nextLine() because A call to scan.nextLine(); returns the next token. It's important to note that the scanner returns a space and a letter, because it's reading from the end of the last token until the beginning of the next line.