title: How to replace the "-" with the guessed letters?
body: <p>I am trying to make a hangman game with String methods, however, I am having trouble replacing the "-" with the correct letter guessed, the specifications on my problem says that I need to concatenate the dashes with the letters that were guessed correctly. </p>
  
  <p>this is the code I have so far for the method that checks if the letter is in the word</p>
  
  <pre><code>public static String reveal(String word, String guess) 
      {
          String dashprints = "-", wholeword=" ";
          for (int index=0; index&lt;= word.length();index++)
          {
              if(index==word.indexOf(letters))
              {
                  return dashprints;
              }
              else
              {
                  dashprints=letters;
              }
              wholeword= dashprints+ wholeword;
  
          }
              return wholeword;
  </code></pre>
  
  <p>The word in the game is:
  graphics</p>
  
  <p>and the initial output is this:</p>
  
  <p>"---------"</p>
  
  <p>and the wanted output is:</p>
  
  <p>"g-------"</p>
  
  <p>however, the output I am getting right now is just this:</p>
  
  <p>"-"</p>