what is wrong with this code please? search scanner object in code playground - Michael Obeng | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is wrong with this code please? search scanner object in code playground - Michael Obeng

17th Jul 2016, 6:37 PM
Michael Obeng
Michael Obeng - avatar
6 Answers
+ 2
Itay is wrong actually. Scanner works in play ground just fine. Only issue with your code is the space after you put Scanner (System.in). Just remove the space to Scanner(System.in) and it works.
17th Jul 2016, 11:22 PM
James
James - avatar
+ 1
That is true, the white space should not be a problem normally.
17th Jul 2016, 11:45 PM
James
James - avatar
+ 1
well, I sent SoloLearn a bug report explaining this weird bug... at first I thought there wasn't an input stream because of the exception... but apparently it is a super strange compiler error....
17th Jul 2016, 11:47 PM
Itay Almog
Itay Almog - avatar
0
as it looks this app does not bind the system.in to anything, so when you try to get the next line it simply can not get it (there isn't any way to give input to the program). try to use eclipse or another ide for it to work.
17th Jul 2016, 6:50 PM
Itay Almog
Itay Almog - avatar
0
thanks
17th Jul 2016, 6:50 PM
Michael Obeng
Michael Obeng - avatar
0
if James is right than it is a bug in the compiler / interpreter the app is using as the white space should be ignored...
17th Jul 2016, 11:28 PM
Itay Almog
Itay Almog - avatar