NOT replacing ? with letter guessed
- by user3720541
i need my code to replace the ? with the letter guessed. The ? needs to be replaced with a for only those to spots. The word in array is parameter.
public static void replace(String[] wordOne, String blanks, char guess)
{
int i;
blanks = wordOne[0];
for (i = 0; i < wordOne.length; i++)
{
for (int j = 0; j < wordOne[0].length(); j++)
{
blanks = blanks.replace(blanks.charAt(j), '?');
if (wordOne[0].charAt(i) == guess)
{
blanks = blanks.replace(blanks.charAt(i), guess);
}
}
}
System.out.println(blanks);
}
}