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 javadocs
next() Returns the next token if it matches the pattern constructed from the specified string. nextLine() Advances this scanner past the current line and returns the input that was skipped.
Which one you choose depends which suits your needs best. If it were me reading a whole file I would go for nextLine until I had all the file.