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

Yeeka Yau
Yeeka Yau
7,410 Points

Cannot Find Symbol Error

Hi, I am getting this error in Java-repl, but can't figure out what I am doing wrong. File loads fine, and then I create a new object exactly as Craig does:

Game game = new Game("treehouse");

But then I get:

ERROR: cannot find symbol
symbol: class Game
location: interface Evaluation
Game method$5u30wekcq29apdzhsix8();

Can't figure out why the error is being thrown.

Here is the class code:

Game.java
public class Game{

  private String mAnswer;
  private String mHits;
  private String mMisses;

  // Constructor to make a new Game object

 public Game(String answer){
    mAnswer = answer;
    mHits = "";
    mMisses = "";
  }

}

Any help would be greatly appreciated!

4 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Did you do this beforehand?

:load Game.java
Yeeka Yau
Yeeka Yau
7,410 Points

Hi Craig, thanks for your help! Yep definitely did that and it loaded fine. I also just compiled and ran Hangman.java via the console, and it worked fine. But through Java-repl, just loading Game.java - I seemed to get this error...strange. Really enjoying your course by the way!

Yeeka Yau
Yeeka Yau
7,410 Points

I still got the error, but the whole thing worked ok from the command line when I compiled and ran Hangman.java, so I have moved on. Thanks.

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Weird can you try to do a

javac Game.java

at the console. See if there is an error.

Craig Dennis
Craig Dennis
Treehouse Teacher

Weird. Did you get past this?

Andrew Brotherton
Andrew Brotherton
7,515 Points

I'm getting the same error, did you find out what may be causing it?