Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Re: Method error for checking and updating guess in a basic hangman game

    Use a pencil and paper. draw a String and mark the spots and lengths needed for the substring method.
    Write a small testing program and experiment.


    I'm done for tonight.
  2. Re: Method error for checking and updating guess in a basic hangman game

    Given the String: "1234" and you want to replace the 3 with an "X"
    newString = "12" + "X" + "4";

    Using substring to get the beginning and ending Strings.
  3. Re: Method error for checking and updating guess in a basic hangman game

    If you can't use StringBuilder class, you'll have to build Strings using substrings and concatenation.
  4. Re: Method error for checking and updating guess in a basic hangman game

    Read the API doc for the replace() method.
    When you call it, you did not pass it an index.
    If all the char in a String are the same(?) how would the method know which one to replace?

    After you...
  5. Re: Method error for checking and updating guess in a basic hangman game

    disguisedWord.replace(letter, secretWord.charAt(i));
    What was the value of disguisedWord when the above was executed? Did it contain a char that is in the variable: letter?

    Did your debug...
  6. Re: Method error for checking and updating guess in a basic hangman game

    I don't see that type of for statement.

    Try debugging the code by adding lots of println statements in the makeGuess() method to show every variables value every time it is tested and changed....
Results 1 to 6 of 6