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 trialTatenda Muringa
4,223 PointsERROR: not a statement
i keep getting the error below, please HELP
ERROR: ';' expected
clear && javac Hangman.java && java Hangman;
^
ERROR: not a statement
clear && javac Hangman.java && java Hangman;
My Hangman.java code is as shown below:
public class Hangman {
public static void main(String[] args) {
// Enter amazing code here:
Game game = new Game("treehouse");
Prompter prompter = new Prompter(game);
prompter.displayProgress();
boolean isHit = prompter.promptForGuess();
if(isHit){
System.out.println("We got a hit!");
} else{
System.out.println("Whoops that was a miss");
}
prompter.displayProgress();
}
}
3 Answers
Robert Richey
Courses Plus Student 16,352 PointsHi Tatenda,
I get those same errors when trying to compile and execute from within the java-repl. We have to compile and execute at a file system prompt in the console:
treehouse:~/workspace$ clear && javac Hangman.java && java Hangman;
Also, I added markdown to help make the code more readable. If you're curious about how to add markdown like this on your own, checkout this thread on posting code to the forum . Also, there is a link at the bottom called Markdown Cheatsheet that gives a brief overview of how to add markdown to your posts.
Cheers!
Juan Francisco Andrade Álvarez
23,997 PointsSure. You have to compile and run the app at the console not within the repl. After that, run again the repl and test your classes as the different stages show throughout the course.
Tatenda Muringa
4,223 Pointshie thnx guys it worked