What is the main difference between next()
and nextLine()
?
My main goal is to read the all text using a Scanner
which may be \"con
From JavaDoc:
- A
Scanner
breaks its input into tokens using a delimiter pattern, which by default matches whitespace.next()
: Finds and returns the next complete token from this scanner.nextLine()
: Advances this scanner past the current line and returns the input that was skipped.
So in case of "small example
next()
should return "small" and nextLine()
should return "small example"