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) Delivering the MVP Refactoring

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 Points

I don't understand my java errors

Here is my workspace snapshot: https://w.trhou.se/95m0sk7ahf

I run this command:

clear && javac Hangman.java && java Hangman 

and I get these errors in the console:

Picked up JAVA_TOOL_OPTIONS: -Xmx128m                                                                                                                                               
Picked up _JAVA_OPTIONS: -Xmx128m                                                                                                                                                   
./Prompter.java:29: error: illegal start of expression                                                                                                                              
  public void displayProgress() {                                                                                                                                                   
  ^                                                                                                                                                                                 
./Prompter.java:29: error: illegal start of expression                                                                                                                              
  public void displayProgress() {                                                                                                                                                   
         ^                                                                                                                                                                          
./Prompter.java:29: error: ';' expected                                                                                                                                             
  public void displayProgress() {                                                                                                                                                   
                             ^                                                                                                                                                      
./Prompter.java:32: error: reached end of file while parsing                                                                                                                        
}                                                                                                                                                                                   
 ^                                                                                                                                                                                  
Hangman.java:8: error: cannot find symbol                                                                                                                                           
      prompter.displayProgress();                                                                                                                                                   
              ^                                                                                                                                                                     
  symbol:   method displayProgress()                                                                                                                                                
  location: variable prompter of type Prompter                                                                                                                                      
Hangman.java:15: error: cannot find symbol                                                                                                                                          
      prompter.displayProgress();                                                                                                                                                   
              ^                                                                                                                                                                     
  symbol:   method displayProgress()                                                                                                                                                
  location: variable prompter of type Prompter                                                                                                                                      
./Prompter.java:30: error: cannot find symbol                                                                                                                                       
    System.out.printf("Try to solve:  %s\n", mGame.getCurrentProgress());                                                                                                           
                                                  ^                                                                                                                                 
  symbol:   method getCurrentProgress()                                                                                                                                             
  location: variable mGame of type Game                                                                                                                                             
7 errors  

2 Answers

It may sound silly, but when you get an error like this (and don't have an IDE to help you) one thing you can do is count out open and closed brackets on your fingers.

For each open bracket, put a finger up, for each closing bracket put a finger down. If you aren't looking at a closed fist by the time you're done counting, then something's gone wrong.

*The question is obviously long solved, but just general info for anyone else seeing a wall of strange errors like this.