Quick Print – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
siteicon
Solved Problem Solved Problem#JAVA#7251

Problem Statement - 03J-2017

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

Solution

next() reads a single token i.e. all characters from the current position till a whitespace is encountered.

nextLine() reads an entire line i.e. all characters from the current position till a new line is encountered.