I am very confused at the behavior of using the || operator on the .equals function. Is there a reason I can not use it on strings or something?
this works:
<
Any Or condition works like this
If first part if true, then second condition is not evaluated If first is false, then second is evaluated If either is true, the result is true.
Now in your case, as input is Y, first condition is false but second is true. Hence the loop evaluates to true.
The while loop will continue till you make the condition false. Hence it continues.