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 Do While Loops

3 Answers

Hi, yes they both insert a new line but using %n instead of \n uses a new line that is best suited to the platform running your code.

I did have to check my memory of that was correct, so you can have a look at the table on here just to see I'm not making that up!!

I hope that helps.


It inserts a new line into a formatted string.


pratham daswani
pratham daswani
398 Points

you mean just like \n?