How is it that for a scanner object the hasNextLine() method returns true while the hasNext() method returns false?
Not
You are consuming the value of next(), but asking for hasNext() and hasNextLine(). next(), per default, returns everything to the next whitespace(). So you are iterating through all whitespace seperated strings, and after each of them you are asking about the nextLine().
i 1 1 -> hasNextLine()? True. hasNext()? Also true.
1 1 -> hasNextLine()? True. hasNext()? Also true (still a whitespace left)
1 -> hasNextLine()? True (Line Seperator, probably). haxNext? False, no whitespace anymore.