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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -