java - Loop prints output twice after initial loop -


**removed code prevent copying ongoing assignment

problem - loop prints output twice

the problem s.nextint() command reads int value. when continue reading s.nextline() "\n" enter key. skip have add s.nextline(). hope should clear now.

try that:

system.out.print("insert number: "); int number = input.nextint();  input.nextline(); // line have add (it consumes \n character)  system.out.print("text1: "); string text1 = input.nextline();  system.out.print("text2: "); string text2 = input.nextline(); 

Comments

Popular posts from this blog

python - Setting ctypes.Structure default values -

java - why am i getting a "cannot resolve method" error on getApplication? -

C# Apple Bonjour - how to monitor service records within Windows -