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 trialMuhammad Umar
7,906 PointsNot running, did exactly as same as Craig did but still not working.
My work: public class Hangman {
public static void main(String[] args) {
// Your incredible 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("Oops missed");
}
}
}
Errors:
Hangman.java:9: error: unclosed string literal
System.out.println("We got a hit!);
^
Hangman.java:9: error: ';' expected
System.out.println("We got a hit!);
^
Hangman.java:10: error: 'else' without 'if'
} else {
^
Hangman.java:14: error: reached end of file while parsing
}
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You're close here, but you missed a quotation mark. This is what is meant by "unclosed string literal".
You wrote:
System.out.println("We got a hit!);
But there should be a quote to start the string and finish it, like so:
// Note the " after the !
System.out.println("We got a hit!");
Hope this helps!