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 Objects Meet Objects Access Level Modifiers

Dante White
Dante White
987 Points

%n I understand why he's using %s but why is he using %n if he removes %n the output is still the same

%n I understand why he's using %s but why is he using %n if he removes %n the output is still the same

%n is used to add a new line after the text it preceeds

3 Answers

Steven Couture
Steven Couture
2,106 Points

%s is used in place of something. but %n is used to make a newline so that those blue letters for treehouse in the compiler are on a new line and not connected. I know that may not have been clear but I hope it helps and let me know if you need it explained better!

Kevin Gates
Kevin Gates
15,052 Points

Dante White , you should mark @Steven Couture's answer as "Best Answer" so he gets points credit for helping you. Also, it helps new students quickly identify the answer to your question.

In Java Basics course wasn't it shown that /n can be used? What's the difference between /n and %n?