java - IF statement not being executed -
i trying execute code if spot in string array equal string value pass in. know array storing correct values , method obtaining correct value threw param (i made sure). when param value matches value in array, if statement nevers gets hit. below code
public void checkwordforletter(string c) { int letterspotindex = 0; int spotnumber = 1; for(int = 0; < (wordletters.length); ++) { system.out.println(wordletters[i]); if(wordletters[i].equals(c)) { system.out.println("letter being looked @ in array is: " + c); letterspot[letterspotindex] = spotnumber; letterspotindex = letterspotindex + 1; spotnumber = spotnumber + 1; } } }
if spot in string array equal string value pass in
i believe want use contains
instead of equals
.
if misunderstood statement, , want use equals perhaps want compare using tolowercase()
on each side.
it's hard tell without knowing array values , received argument.