Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Basics Using your New Tools Coding the Prototype

Andre Koehler
Andre Koehler
1,008 Points

I keep getting an error and cannot figure this out and keep getting an error, please help!

I keep getting errors and looked at the other questions and still cannot solve the problem. Here is my 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!
     // __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, noun);
      console.printf("They are always %s %s. \n", adverb, verb);

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

Hey there Andre, I edited your post to include the syntax Markup, be sure to check the Markdown Cheatsheet if you have any questions on that.

From the syntax it looks like it's trouble somewhere with the quotation marks of your strings, but can you please let us know what error you are getting so that I can give it a closer look?

1 Answer


It looks like you have a typo in one of your strings.

console.printf("Your TreeStory:\n-----n\");

You have the backslash prior to the quotation mark which is escaping it so you never end your string. Instead you want to have it as

console.printf("Your TreeStory:\n-----\n");

Assuming you were trying to get a newline at the end of the string.

Andre Koehler
Andre Koehler
1,008 Points

That fixed the problem, thanks! Can't believe I overlooked that one numerous times.