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 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.