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

Java repl

Why is it when I am in the repl and I am entering the code

Game game = new Game("treehouse");

it give me the error

java.util.NoSuchElementException?

I tried closing and reloading the workspace and repl a few times and I always get the same result. What is going on here?

Chris Batt
Chris Batt
11,610 Points

I'm having the same issue. Commenting to tag for answer.

4 Answers

Chris Batt
Chris Batt
11,610 Points

Found my issue, maybe it's the same. I ran javac Hangman.java and it said there was no return statement. At 6:24 in the video, he enters "return isHit;" and at 6:38 it's off the screen forever. I missed it the first couple times. After I added that, the code compiled and ran fine.

HTH.

Chris thank you again. I got it to work after the return and compiling. At the end I did not put game.applyGuess('t'); It is working well now. I was only inputting applyGuess('t');

I am still working in the Game.java portion I haven't programmed anything in the Hangman portion yet. I am watching the video on Storing Guesses that deals with Characters and Strings.

Chris thank you. I added the return statement and both the Hangman.java and Game.java are compiling. I go to the repl and load both and no problem. I enter Game game = new Game("treehouse"); no problem. I enter applyGuess('t'); and and error comes up that it cannot find the method applyGuess. I wish I could do the black background screenshot like the rest of the folks are doing so I can post it. Day three on this problem.