In my following code, I convert a string array to a char array to alter the characters.
char[][] currentGuessArray = new char[currentGuessPhrase.length][];
for (int x = 0; x < currentGuessPhrase.length; x++) {
currentGuessArray[x] = currentGuessPhrase[x].toCharArray();
}
for (int x = 0; x < correctPhrase.length; x++) {
for (int a = 0; a < correctPhrase[x].length(); x++) {
if (correctPhrase[x].charAt(a) == guess) {
currentGuessArray[x][a] = guess;
}
}
I tried the following:
for (int x = 0; x < currentGuessArray[x].length; x++){
currentGuessPhrase[x] = currentGuessArray[x].toString();
}
But it doesn't seem to alter the code.
The string array contains random words like: "fire", "golden", "illegal", etc.
Edit: Here is an example run:
miracles
horrible
illegal
horrible
good
Those are the Strings stored in currentPhrase[]
Input: a
Expected output:
___a____ ________ _____a_ ________ ____
Actual output:
[C@5265a77f [C@fd7ad1c [C@18a61164 [C@3ebfc8e0 ____