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 trialSuzette Glenn
2,232 PointsKeep getting a error: reached end of file while parsing console.printf
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 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. ", name, adjective, noun);
console.printf("They are always %s %s.\n", adverb, noun);
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
TreeStory.java:23: error: reached end of file while parsing
console.printf("They are always %s %s.\n", adverb, noun);
^
1 error
I don't see what i'm doing wrong, please help.
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHi Suzette,
First, I added markdown to your post, so that the code can be read in the Community. Without markdown, the code is pretty much unreadable.
When including code in a question, you'll need to use markdown. There is a Markdown Cheatsheet link just above the post button, or you can have a look at this Treehouse course on Markdown Basics.
As to your question, that error pretty much always means that there are missing closing curly braces. Here, I don't see a closing brace for the Class
or for the Method
, so it looks like you are missing 2 closing curly braces.
Hope that solves it. :)
Mark Casavantes
Courses Plus Student 13,401 PointsGood Afternoon Suzette,
I think you may need some closing brackets in your program.
}
}
That is usually the cause of a reached end of file while parsing error messages.
Suzette Glenn
2,232 PointsSuzette Glenn
2,232 PointsThank You! That worked. I'll look into that course.