So I am doing a lab for my into to java programming class. I am playing the game of hangman using the console on jedit. They are only allowed to guess one letter at a time. At the beginning, only asterisks are displayed to show the number of letters. For example if the word was elephant it would display *********. Once they guess the letter e, it will display e*e*****. I have created a method that returns an array of characters which is the asterisks based on the number of letters in the word. I can't figure out how to replace the asterisks with the correct letter. Please help!
public static char[] asterisk(String x) {
char[] word = new char[x.length()] ;
for( int i=0; i< x.length(); i++) {
word[i] = '*' ;
}// end for loop
return word ;
} // end asterisk method
String#toCharArray, you know...