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
James Mackey
Courses Plus Student 994 PointsArrays and Command Line Arguments
public class Hangman {
public static void main(String[] args) {
// Enter amazing code here:
if (args.length == 0)
System.out.println("Please enter a word");
System.exit(0);
}
Game game = new Game(args[0]);
Prompter prompter = new Prompter(game);
prompter.play();
}
Hangman.java:11: error: <identifier> expected
prompter.play();
^
1 error
2 Answers
Seth Kroger
56,416 PointsYou forgot the opening curly brace on your if statement, which causes the closing brace to be interpreted as the end of the method instead of the if statement.
if (args.length == 0) { // <- add this brace here
System.out.println("Please enter a word");
System.exit(0);
}
Cindy Lea
Courses Plus Student 6,497 PointsIt looks like its looking for another keyword in front of prompter.play