What is the difference between .nextline() and .next() | Sololearn: Learn to code for FREE!

+3

What is the difference between .nextline() and .next()

10/11/2017 1:15:28 PM

Gaurav Nagar

1 Answer

New Answer

+5

.nextLine() = reads a line of string including the spaces .next() = reads word SEPARATED with space ,it will not read any string after the space. input: hello world using .nextLine() will save hello world but using .next() will only save hello when you want to save hello world in .next() you need to input: hello <enter> world <enter>