Java, Combine two strings into one if statement?
I am trying for making it so if your user inputs Sure OR yes it affirms something different thene after they input not any or Simply no.This will be what i’ve so a long way:
in the event (yes.equals(“yes”))
System.out.println(“Good”);
in addition
System.out.println(“Bad”);
I want to cause it to something in this way:
in the event (yes.equals(“yes”), (“Yes”))
or something like that.Please help! Thank you!
This will do
if(yes.equalsIgnoreCase(“yes”)
System.out.println(“Good”);
else
System.out.println(“Bad”);
Also you can do this
in the event ((yes.equals(“yes”)) (yes.equals(“YES”)))
System.out.println(“Good”);
in addition
System.out.println(“Bad”);
Expect this allows, Thanks
If you want to accept top or lessen case insight then upgrade your compatible with equalsIgnoreCase.
Leave a Reply
You must be logged in to post a comment.