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 Coding the Prototype

Naya Willis
Naya Willis
2,461 Points

I have the exact information typed into the workspace, and the program isn't running. I keep getting this error message

TreeStory.java:21: error: reached end of file while parsing
console.printf("They are always %s %s. \n", adverb, verb);
^

Naya Willis
Naya Willis
2,461 Points

the "up arrow" is actually placed behind the semicolon

2 Answers

Rob Bridges
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 Points

Hello, when you get the error "Reached the end of file while parsing" That means that there is a missing ending curly brace } somewhere in your code. It might be at the end of this line, go ahead and add one. If that doesn't help feel free to post your code and I can look at it and try to find out where it is.

Thanks.

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!
    */
   //__Name__is a __adjective__ __noun__.  They are always __adverb__ __verb__.
   String name = console.readLine("Enter a name:  ");
   String adjective = console.readLine("Enter an adjective:  ");
   String noun = console.readLine("Enter a noun:  ");
   String adverb = console.readLine("Enter an adverb:  ");
   String verb = console.readLine("Enter a verb ending with -ing:  ");

   console.printf("Your TreeStory:\n---------------\n");
   console.printf("%s is a %s %s.  ", name, adjective, noum);
   console.printf("They are always %s %s.\n", adverb, verb);
}

TreeStory.java:23: error: reached end of file while parsing
}
^
1 error
treehouse:~/workspace$

Rob Bridges
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 Points

Based on your code you have 2 opening curly braces, one after your class declaration and the other after your public static void main, however I am only seeing one closing brace. Go ahead and add another } at the bottom of your code, it should fix this.

Isaiah Marin
Isaiah Marin
11,971 Points

Also, your variable noun is spelled as noum instead of noun. On the third to last line.

console.printf("%s is a %s %s. ", name, adjective, noum);