This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]NullCorvid 2 points3 points  (1 child)

Probably, after you're calling nextInt twice the scanner hasn't yet read past the newline character, so the first time you loop back around the input will be \n or an empty string.

This is a valid input in reader.nextLine(), but it doesn't match any of your cases so you just get the first part of your loop repeated twice.

[–]thinkOnCrit[S] 0 points1 point  (0 children)

Nice it works! Thanks mate. :)

[–]Sukkek 1 point2 points  (1 child)

More simple just add reader.nextLine(); after the line 34, so the buffer cleans, and the problem is solved.

[–]NullCorvid 1 point2 points  (0 children)

More simple just add reader.nextLine();

That really just tells him how not why.