Java: Please tell Me what's wrong? -
here's code:
system.out.println("qualifies instate rate: "); instate = keyboard.nextline(); while((instate.equalsignorecase("yes") == false || instate.equalsignorecase("no") == false)) { system.out.println("enter either yes or no:"); instate = keyboard.nextline(); }
my problem output never-ending; here's output
enter either yes or no: no enter either yes or no: no enter either yes or no: yes enter either yes or no: yup enter either yes or no:
it doesn't matter enter in keyboard. please tell me problem , possible solutions.
change:
system.out.println("qualifies instate rate: "); instate = keyboard.nextline(); while((instate.equalsignorecase("yes") == false || instate.equalsignorecase("no") == false)) { system.out.println("enter either yes or no:"); instate = keyboard.nextline(); }
to:
system.out.println("qualifies instate rate: "); instate = keyboard.nextline(); while((instate.equalsignorecase("yes") == false && instate.equalsignorecase("no") == false)) { system.out.println("enter either yes or no:"); instate = keyboard.nextline(); }
Comments
Post a Comment