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 trialMichael Singleton
6,253 PointsThe question asked me to call printf in the console and have it print my name code> console.printf(firstName); wrong?
what went wrong?
2 Answers
Ken Alger
Treehouse TeacherMichael;
Welcome to Treehouse!
This challenge has three separate tasks, it sounds like you made it through task 1 in which we assign the string firstName
a value of your first name. That code should look something like:
String firstName = "Michael";
correct?
Task 2
Call the printf
function on the console
object and make it print out "<YOUR NAME> can code in Java!"
It sounds like you are on Task 2. We literally need to print out, in your case, "Michael can code in Java!" without the use of string formatters like were shown in the video. The challenge engine checker is picky about how and what is printed so make sure your formatting is the same as is requested.
I hope that helps and happy coding,
Ken
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHello the printf command is to format a string. They were looking for something like console.printf("Hello, my name is %s\n", firstName) This tells the console that you are printing the variable firstName in the place of the %s in the string.
Hope this helps.