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[0]. 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[0] is a String array that contains either "C" or "c" //e[0] is a String array that holds words if (a[0] == ("C" || "c")) e[0] = "Correct";
Any help is appreciated. Thanks.
Tim West
Ranch Hand
Joined: Mar 15, 2004
Posts: 539
posted
0
|| 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.
--Tim
James Dark
Greenhorn
Joined: Mar 06, 2004
Posts: 11
posted
0
Thanks again! You helped me save so many lines of code!