Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Objects (Retired) Creating the MVP Storing Guesses

Dean Onizuka
Dean Onizuka
4,753 Points

[SOLVED] error: cannot find symbol applyGuess

not sure why this isnt working...

public class Game {
  private String mAnswer;
  private String mCorrect;
  private String mWrong;

  public Game(String answer) {
    mAnswer = answer;
    mCorrect = "";
    mWrong = "";
  }

  public boolean applyGuess(char letter) {
    boolean isCorrect = mAnswer.indexOf(letter) >= 0; 
    if (isCorrect) {
      mCorrect += letter;
    } else {
      mWrong += letter;
    }
    return isCorrect;
}
}
ERROR: cannot find symbol                                   
  symbol:   method applyGuess(char)                         
  location: class Evaluation                                
    applyGuess('o');;                                       
    ^                
Dean Onizuka
Dean Onizuka
4,753 Points

figured it out. gonna leave this up just in case anyway else runs into this problem but when using the repl make sure you type game.applyGuess and not just applyGuess

thanks Dean! this one kinda stumped me.

Berkley Frei
Berkley Frei
6,292 Points

I had the same problem- thanks for the solve!

Thank you for keeping this up. I too encountered the same error and this helped solve it.