0

help me with this code

I tried to cofe it but it seems to not work.. https://code.sololearn.com/cyk4uotgNylA/?ref=app

29th Apr 2020, 11:33 AM
Anirban Bora
Anirban Bora - avatar
3 Answers
+ 1
Keep that scanner outside for Loop you can run scanner only one time possibly the error you are receiving is discussed here https://stackoverflow.com/questions/13042008/java-util-nosuchelementexception-scanner-reading-user-input
29th Apr 2020, 11:43 AM
Abhay
Abhay - avatar
+ 1
this Scanner declared outside loop is better, but it is Sololearn specific problem, Your code works ok on desktop. Program expects 3 x String as input.
30th Apr 2020, 12:12 PM
zemiak
+ 1
bro I just used a .nextLine which read the \n buffer and now the code works.
30th Apr 2020, 4:21 PM
Anirban Bora
Anirban Bora - avatar