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

Lauren Lolo
Lauren Lolo
352 Points

Parsing?

The error I have says this:

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

do I need to change something?

3 Answers

Hey Lauren,

This error most likely indicates that you either have an extra closing curly bracket somewhere that is unnecessary or forgot to close a block of code.

Could you please post your code?

Best,

Jacob

Lauren Lolo
Lauren Lolo
352 Points

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(n) %s %s. ", name, adjective, noun); console.printf("They are always %s %s, \n", adverb, verb); }

here is my code, thanks for the help!

Hey Lauren,

It looks like you are missing a closing curly bracket for the TreeStory class declaration.

Try this:

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(n) %s %s. ", name, adjective, noun);
        console.printf("They are always %s %s, \n", adverb, verb);
    }
} //You missed this closing curly bracket.

Best,

Jacob

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hey Lauren,

try to put

(```java)

before

// awesome code

(```)

after

your code - WITHOUT THE PARENTHESES

So your code will look like a bomb ! And watch the cool video Tips for asking questins ...

Wish a nice day !

Stephen Ribecca
Stephen Ribecca
1,323 Points

Hello all,

I have the same issue, but I have that closing bracket. 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);
}