This is my first question on this site so i\'ll try not to be a total noob..
I\'m currently creating hangman game in java. So my question to you is if we are given a wor
I think the most easy way would be storing the state in a variable and by looping over the real world replace the matching characters.
private String word;
private char[] state;
public void guess(char input){
for (int i = 0; i < word.length(); i++) {
if (word.toLowerCase().charAt(i) == input){
state[i] = word.charAt(i);
}
}
}
afterwards you can print the contents of "state".