+ 4

Scanner Input Problem in Java

Taking input by a object of the Scanner class is very problematic. Please visit my code. My questions are in comments. https://code.sololearn.com/c6Xunlk0IlS9/?ref=app

15th Aug 2018, 5:45 AM
Sayan Kundu
4 Respuestas
+ 3
String s; scan.nextLine(); // Clear "\n" leftover by previous input. s = scan.nextLine(); Hth, cmiiw
15th Aug 2018, 7:11 AM
Ipang
+ 6
KrOW you right but it depends on the no. of inputs ...if it's input is more than once then during running time process the first input is taken ..second input requires enter to be pressed
15th Aug 2018, 4:20 PM
Yesh Jadav
Yesh Jadav - avatar
+ 4
Because SL system, you have to put all your program input, all in once time (differently on local environment like your PC)
15th Aug 2018, 6:43 AM
KrOW
KrOW - avatar
+ 1
Better use BufferedReader
16th Aug 2018, 6:25 PM
Artem Muravlev
Artem Muravlev - avatar