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 trialLogan Joseph
39 PointsString firstName = "Logan"; console.printf("Logan can code in Java!"); console.printf("%s can code in Java!");
%s won't replace my name
// I have setup a java.io.Console object for you named console
String firstName = "Logan";
console.printf("Logan can code in Java!");
console.printf("%s can code in Java!");
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You're close here. Only one printf
statement is needed. You've set up a variable that's storing your first name, so we want to use that. Remember, that good coders are inherently sort of lazy. We want the computer to do as much work for us as we can.
So your last line should look like this:
console.printf("%s can code in Java!", firstName);
The %s
tells Java to insert the value of a string type variable at this point in the string. But you still have to tell it which variable to use there. You might have lots of string variables in your code.
Hope this helps!