Scanner Input Problem in Java | Sololearn: Learn to code for FREE!

+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

8/15/2018 5:45:36 AM

Sayan Kundu

4 Answers

New Answer

+3

String s; scan.nextLine(); // Clear "\n" leftover by previous input. s = scan.nextLine(); Hth, cmiiw

+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

+4

Because SL system, you have to put all your program input, all in once time (differently on local environment like your PC)

+1

Better use BufferedReader