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 trialTestertroy Emerson
950 Pointswhat is printf
strings
// I have setup a java.io.Console object for you named console
String firstName = "YOUR NAME";
console.printf("%s\n", firstName);
2 Answers
tobiaskrause
9,160 PointsIt is a format method...you alwas uses this with the string formater (when you use the %s) More information: https://docs.oracle.com/javase/tutorial/java/data/numberformat.html https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html
It is used for formated output It is used for string inheritance
lambda
12,556 Pointsprintf() is a method (don't worry about what a method is right now) used to print output to the console. Without the console.printf(...) you would not see the output on your screen; it would be blank.
So someone else wrote code for printf() and you are using it to print output to your screen/console.