Let's say I am trying to assign variable hit to true or false depending on whether user input is equal to either "yes" or "y" (I have the .toLowerCase() handled). Is there a way I can use .equals in a way that compares one string to two other strings all in the same line? I did a bit of searching, but I did not find anything, possibly because of the wording of a question like this. My line of code:
boolean hit = kb.next().toLowerCase.equals("y"); // Change something to see if kb.next() also equals "yes"
So, to repeat, the code should see whether string a equals string b or string c. If it is impossible to do this on one line, then just say so in the comments or provide an alternative that is hopefully concise.