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 Getting Started with Java Strings and Variables

Daniel Smithson
Daniel Smithson
1,076 Points

\n not working for line break. I reviewed the questions to see if my answer was there.

I reviewed the questions but only found those who mistakenly use forward slash. I tried it again and again. My text just appears all bunched up.

console.printf("Hello, my name is %s\n", firstName);
console.printf("%s is learning how to write java\n", firstName);

Moderator Edited: Added Markdown to the post, so the code is more readable. For more information on how to place code in your posts, please refer to the Markdown Cheatsheet.

3 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Daniel,

The code is correct, and the line breaks should appear. Did you make sure that you saved your changes before re-compiling and running?

:dizzy:

Vedang Patel
Vedang Patel
7,114 Points

Try putting %n instead

YiSzen Tang
YiSzen Tang
2,221 Points

Are you sure when you compiled you had all the capitals because I think it's case sensitive.