Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.