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 trialVincent Rickey
5,581 PointsError: cannot find symbol (Java objects / Creating the MVP / Current progress lesson)
I went over my code a few times, but I can't seem to find the mistake. When I try to run Hangman.java at the end of the lesson I am met with the following error in the Console:
./Prompter.java:18: error: cannot find symbol
System.out.printf("Try to solve: %s\n", mGame.getCurrentProgress());
^
symbol: method getCurrentProgress()
location: variable mGame of type Game
1 error
Here is my code for Prompter.java:
import java.io.Console;
public class Prompter {
private Game mGame;
public Prompter(Game game) {
mGame = game;
}
public boolean promptForGuess() {
Console console = System.console();
String guessAsString = console.readLine("Enter a letter: ");
char guess = guessAsString.charAt(0);
return mGame.applyGuess(guess);
}
public void displayProgress() {
System.out.printf("Try to solve: %s\n", mGame.getCurrentProgress());
}
}
Thanks!
2 Answers
Ken Alger
Treehouse TeacherVincent;
Do you have a getCurrentProgress()
method in your Game.java
file and are they spelled the same?
Ken
Vincent Rickey
5,581 PointsThanks, Ken! My mistake-- I was missing an "r" in "Progress" in the Game.java file.