Hi everybody, why I can't use two times System.in here in Sololearn? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hi everybody, why I can't use two times System.in here in Sololearn?

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

29th May 2018, 4:47 AM
Anthony
Anthony - avatar
2 Answers
+ 7
Just use one scanner to handle multiple inputs. Having multiple scanners on the same stream is a bad practice (and also often confusing), as it will corrupt your input stream and invalidate your Scanner object.
29th May 2018, 5:48 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
https://www.sololearn.com/learn/Java/2220/?ref=app this is a way to get input from one Scanner class
29th May 2018, 7:19 AM
Arun Tomar
Arun Tomar - avatar