Scanner user input not working in conjunction with while loop.
I'm sure I'm doing something completely idiotic but this is stumping me. I'm having the same issue with another program and have no clue where to go from here.
When I comment out the while loop it works perfectly. With the while loop active, if I enter a number that shouldn't activate it, string2 is not printed but I'm given a second Scanner input box that shouldn't be there. If I do trigger the while loop, it prints string2 but then the same problem - it gives me a second, unnecessary Scanner input box.
Scanner s = new Scanner(System.in);
while(s.nextInt() < 10)
int n = s.nextInt();
Can anyone help me? Please!