I am trying to execute code if a spot in my String array is equal to a String value I pass in. I know my array is storing the correct values and the method is obtaining the correct value threw the param (I made sure). When the param value matches a value in the array, the if statement nevers gets hit. Below is my code
public void checkWordForLetter(String c)
{
int letterSpotIndex = 0;
int spotNumber = 1;
for(int i = 0; i < (wordLetters.length); i ++)
{
System.out.println(wordLetters[i]);
if(wordLetters[i].equals(c))
{
System.out.println("Letter being looked at in array is: " + c);
letterSpot[letterSpotIndex] = spotNumber;
letterSpotIndex = letterSpotIndex + 1;
spotNumber = spotNumber + 1;
}
}
}
Aucun commentaire:
Enregistrer un commentaire