Use:
String x = kb.next();
instead of kb.nextLine()
.
This is because nextInt()
reads just the number, not the end of line or anything after the number. When you call nextLine()
it reads the remainder of the same line and does not wait for input.
Ideally you should call kb.nextLine()
the line after your code for nextInt()
to ignore the rest of the line.