I ran into an interesting situation when writing my program.
I am required to accept a word from the user to determine to continue the loop. Using .nextLine()
did not allow the user to enter input and the program was aborted, but .next()
ran perfectly fine.
I thought the difference was that .next()
accepted input until the first space in the string while .nextLine()
accepted the entire string.
Why does it matter if both are supposed to accept a user's input.. is there more to this?
.next() works perfectly fine for my program, but I'm curious for the future in case it happens again.
Thanks.