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 trialyahya hussein
2,516 PointsCannot find symbol error
my code is throwing this error Hangman.java:6: error: cannot find symbol while (game.getRemainingTries() > 0){ ^ symbol: method getRemainingTries() location: variable game of type Game ./Prompter.java:21: error: cannot find symbol game.getRemainingTries(), ^ symbol: method getRemainingTries() location: variable game of type Game 2 errors
prompter.java file import java.util.Scanner;
class Prompter { // Prompt user for input by storing instance of game inside variable private Game game;
public Prompter(Game game){
this.game = game;
}
public boolean promptForGuess(){
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a letter: ");
String guessInput = scanner.nextLine();
char guess = guessInput.charAt(0);
return game.applyGuess(guess);
}
public void displayProgress(){
System.out.printf("You have %d tries left to solve: %s%n",
game.getRemainingTries(),
game.getCurrentProgress());
}
} I can't seem to locate what the issue is, rewatched the video and everything matches the teacher. It may be something that i missed.
1 Answer
yahya hussein
2,516 Pointsnvm it was a spelling error inside my getRemainingTries method inside of game.java. Forgot the first 'i' inside of 'remaining'