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 Prompting for Guesses

reached end of file while parsing. workspace

What am I doing wrong?

public class Hangman {

public static void main(String[] args) {
    // Enter amazing code goes here:
    Game game = new Game("treehouse");
  Prompter prompter = new Prompter(game);
  boolean isHit = prompter.promptForGuess();
  if (isHit) {
    System.out.println("We got a hit!");
  } else {
    System.out.println("Whoops that was a miss");
  }
}

I tried adding and subtracting a curly bracket at the end. Still didn't work. my code looks identical to Craig's

2 Answers

Simon Coates
Simon Coates
28,694 Points

The code you posted is definitely missing a closing }. I copied your code into my existing Hangman workspace, ran compile and got the error. Added a } at the end, saved and compile worked.

Assuming the "public class Hangman {" before your code block is in your code, then you are missing a final curly brace to close out the Hangman class.