KnowledgeBoat Logo
|

Computer Applications

What is the difference between the Scanner class functions next() and nextLine()?

Input in Java

ICSE 2017

13 Likes

Answer

next()nextLine()
It reads the input only till space so it can read only a single word.It reads the input till the end of line so it can read a full sentence including spaces.
It places the cursor in the same line after reading the input.It places the cursor in the next line after reading the input.

Answered By

7 Likes


Related Questions