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 trialAndre Koehler
1,008 PointsI 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);
}
}
1 Answer
James Simshaw
28,738 PointsHello,
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
1,008 PointsThat fixed the problem, thanks! Can't believe I overlooked that one numerous times.
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsRob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHey 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?