java - Input not being scanned -
i have while loop asks user if he/she wants continue program or not. problem is, after printing "continue?" not scan user's input, rather ends program already. problem?
system.out.println("continue? (y/n)"); choice = in.nextline(); } while(key.equalsignorecase("y"));
while(key.equalsignorecase("y"));
should be:
while(choice.equalsignorecase("y"));
or better, use startswith(
more unix'y behavior.
Comments
Post a Comment