To answer your question about the while loop condition directly (are the two conditions equivalent?):
No, they aren’t equivalent, but it’s only a small change needed. The following two conditions are equivalent by DeMorgan’s Law.
boolean b1 = (response != '4' && response != '3' && response != '2' && response != '1'); // (note: I corrected what looked like a typo here ^^) boolean b2 = !(response == '4' || response == '3' || response == '2' || response == '1');
So basically you have to add a
! before your second while loop condition to make them equivalent (assuming it really was a typo in the first one).
(Note: you still need to have the
! inside the while loop parentheses though, so it will look like