Hi. I wanted to know how to be able to place a statement that will check if either letters are equal to the letter stored in a. I know I could break it up but would like to know how to do it in one line. Do you have to do ASCII keys or something?
//a is a String array that contains either "C" or "c" //e is a String array that holds words if (a == ("C" || "c")) e = "Correct";
Any help is appreciated. Thanks.
Joined: Mar 15, 2004
|| can only operate on booleans: what you give it on either side must evaluate to a boolean. If 'a' is an array of Strings:
I guess you could use == instead of .equals() here, but it's still generally a Bad Thing with Strings.
Joined: Mar 06, 2004
Thanks again! You helped me save so many lines of code!