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


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.

8/15/2018 5:45:36 AM

Sayan Kundu

4 Answers

New Answer


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


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


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


Better use BufferedReader