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 trialdan le
Courses Plus Student 2,196 PointsCall the printf method on the console object and make it write out "<YOUR NAME> can code in Java!" doesnt' work
Call the printf method on the console object and make it write out "<YOUR NAME> can code in Java!" doesnt' work
console.printf("My Name");
// I have setup a java.io.Console object for you named console
String firstName = "Dan";
console.printf("YOUR NAME");
1 Answer
Michael Hess
24,512 PointsHi dan le,
In the printf statement, %s is a place holder for a variable. The first name variable is written outside of the double quotation marks within the printf statement. Please see the following code sample:
String firstName = "Dan";
console.printf("%s can code in Java!", firstName);
If you have further questions shout them out! Hope this helps!