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
coopercowley
210 Pointshow to print sentences on separate lines java
hi this is what ive written
console.printf ("Hello" /n);
console.printf ("My name is Cooper");
2 Answers
Grigorij Schleifer
10,365 PointsHI coopercowley,
you can use the %n combination to start a new line.
So if you code
String name = "coopercowley";
String secondName = "treehouse";
console.printf ("Your name is %s %n and you learning at %s", name, secondName);
So the output will look like:
Your name is coopercowley
and you learning at treehouse
coopercowley
210 Pointsthanks!
Grigorij Schleifer
10,365 PointsYou are so welcome !
Greets from germany :)