Next & NextLine | Sololearn: Learn to code for FREE!


Next & NextLine

What is the difference between next and nextLine ?!

1/11/2017 12:21:10 AM

Omran Sulaiman

2 Answers

New Answer


Let's imagine that numbers are words. Then: Next reads only words. NextLine reads sentences. Example: input string: One 1 two 2 three 3 next will return only one word - 'One' nextLine will return all string - 'One 1 two 2 three 3'


That mean "next" not take the space just take the words if not accessed space Either "nextLine" can take words with space "sentences"