0 votes
in JAVA by

What is the difference between next () and nextline () in java?

1 Answer

0 votes
by

 What is the difference between next () and nextline () in java?

next() can read the input only till space. It can’t read two words separated by space. Also, next() places the cursor in the same line after reading the input. nextLine() reads input including space between the words (that is, it reads till the end of line \n).

Related questions

0 votes
asked Oct 17, 2020 in JAVA by rahuljain1
+2 votes
asked May 30, 2020 in JAVA by Robindeniel
...