Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Matte matt
568 PointsCall the printf method on the console object and make it write out "<YOUR NAME> can code in Java!" Doesn;t work HELP
Console printf (firstName; "can code in Java"); i put this and it doesn't work, and i'm pretty sure this is the answer anyone can help me? i really need HELP
// I have setup a java.io.Console object for you named console
firstName = "Matteo";
Console printf (firstName; "can code in Java");
2 Answers

Amanda Wagner
6,070 PointsI tried this and it worked for me.
firstName = "Matteo";
console.printf("firstName can code in Java!");

Craig Dennis
Treehouse TeacherHi Matte...your missing a few things. First you need to declare firstName
as a String
.
On your second line, the format string comes first. Remember to put a %s
where you want the variable to be replaced.
Here is a similar example:
String dayOfTheWeek = "Monday";
console.printf("Today is %s", dayOfTheWeek);
Hope that helps!
Craig Dennis
Treehouse TeacherCraig Dennis
Treehouse TeacherReally close Amanda!
Seems like you are missing the String declaration and the replacement of the parameter.