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

when I try to make an object in java-repl it cant recognize the symbol Game game = new Game("treehouse");

i tried to find errors in each class by typing javac Prompter.java javac Game.java javac Hangman.java

all of the classes have no errors; however after typing :load Game.java and then typing Game game = new Game("treehouse"); i get an error message saying that it cant find the symbol Game.

1 Answer

please post Game.java class please

Looks to me that there is no constructor that takes first argument "String"...

So in order to call Game game = new Game("treehouse")

You have to have the following in your Game class...

public class Game {
   // some code
   // construtor that you are calling when type
   // Game game = new Game("treehouse")
   public Game(String name) {
     // some code
   }
}

If there is no such constructor than you should have this error but I'm not sure

So post Game class

Hi I just saw your post. I figured it out. Thank You though!