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 Creating the MVP Prompting for Guesses

Hangman.java:6 error: cannot find symbol

Hangman.java:6: error: cannot find symbol
Prompter prompter = new Prompter(game);
^
symbol: class Prompter
location: class Hangman
Hangman.java:6: error: cannot find symbol
Prompter prompter = new Prompter(game);
^
symbol: class Prompter
location: class Hangman
2 errors

Any ideas? I've checked for spelling mistakes with prompter.

Here is my Prompter.java import java.util.Scanner;

class Prompter { private Game game;

public Prompter(Game game) { this.game = game; }

public boolean promptForGuess(){ Scanner scanner = new Scanner(System.in); System.out.print("Enter a letter: "); String guessInput = scanner.nextLine(); char guess = guessInput.charAt(0); return game.applyGuess(guess); } }

1 Answer

It's probably something wrong with your import since it can't find the Prompter class.
Have you also compiled the Prompter.java file? Before you run your program make sure that all .java files are compiled so that you also have the following 3 files in your workspace: Game.class, Hangman.class, and Prompter.class.