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 trialManole Malai
33 Pointshow to replace "Manole" in the next line? I don't get how to format the string.
how to replace "Manole" in the next line? I don't get how to format the string.
// I have setup a java.io.Console object for you named console
String firstName="Manole";
console.printf ("Manole can code in Java");
console.printf ("Manole can code in Java");
2 Answers
Petri Laine
Courses Plus Student 858 PointsPut %s as a "placeholder" for the String variable, then after the quotation marks put a comma ( , ) and after that put the name a.k.a identifier of your String variable (firstName). It will look like this: console.printf("%s can code in Java", firstName);
This can be done with multiple Strings as well, just put %s to each point you want, then after a comma list each String in the desired order separating each String with a comma. Good luck learning!
Manole Malai
33 Pointsthank you :)