If I have a string that stores an answer to a question and a for loop used to conceal the answer with underscores, is it possible to replace a character in the string answer with the user's guess and reveal it or to somehow alter the string answer to reveal only the user's right guess? Here is part of my code:
String answer = "December"; // this is the phrase i want hidden with
//underscores
for loop( int i = 0; i < answer.length(); i++){
System.out.println("_"); // hides phrase with underscores
System.out.print("What is your guess for this round?");
String userGuess = console.next();
char ch = answer.charAt(i);
if (userGuess.indexOf(ch) != -1) { // if it is present in phrase then reveal
// then reveal that letter