Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

Can anyone tell me what’s the difference between next() and nextLine() from scanner class?

1 Answer

0 votes
by (19.7k points)

nextLine(): To read input and to parse the string. It moves the scanner below after returning the current line.

next(): It returns any values which comes before delimiter (default to whitespace)

Interested in Java? Check out this Java Certification by Intellipaat.   

Related questions

0 votes
1 answer
asked Feb 1, 2021 in Python by ashely (50.2k points)
0 votes
1 answer

Browse Categories

...