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 Basics Using your New Tools Multiple Strings

Romi Stepovich
Romi Stepovich
8,473 Points

I'm getting an error when I'm trying to compile that says reached end of file while parsing.

Here is the code:

import java.io.Console;

public class TreeStory {

    public static void main(String[] args) {
        Console console = System.console();
        /*  Some terms:
            noun - Person, place or thing
            verb - An action
            adjective - A description used to modify or describe a noun
            Enter your amazing code here!
        */
      String name = console.readLine("Enter your name: ");
      String adjective = console.readLine("Enter an adjective: ");
      console.printf("%s is very %s", name, adjective);
      {

      }   
And here is the error code I am getting:
TreeStory.java:18:  error:  reached end of file while parsing
        )
          ^
1 error

4 Answers

Dan Johnson
Dan Johnson
40,533 Points

Typically you get this error when you have missing closing braces. In this case you have an open and close brace at the end of the file instead of two closing (one to close the method definition, and the other the class).

Romi Stepovich
Romi Stepovich
8,473 Points

Thanks, Dan. :)

I knew it was something with the brackets, but I'm not getting where those closing braces are supposed to go exactly...

Romi Stepovich
Romi Stepovich
8,473 Points

Actually, I figured it out. I went onto an older tutorial to look at the brackets. Thank you for your help!

Romi Stepovich
Romi Stepovich
8,473 Points

*Braces not brackets (although in my mind they all seem like brackets)