Why is it that when the input to this code is "as, if, they" the program only prints out "as". | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is it that when the input to this code is "as, if, they" the program only prints out "as".

https://code.sololearn.com/cFDRz92y1OAj/?ref=app

2nd May 2020, 9:19 AM
Uwem Neku
Uwem Neku - avatar
2 Answers
+ 3
You should use method nextLine() instead of next() Cause next() takes only the next world, nextLine() takes the whole line
2nd May 2020, 9:33 AM
Marina Vasilyova
Marina Vasilyova - avatar
0
Thanks. This just proves the level of my amateur skills. 😂. Thanks
2nd May 2020, 11:00 AM
Uwem Neku
Uwem Neku - avatar