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 trialMichelle Mangwiro
Courses Plus Student 467 PointsJava Basics- Your name task
I don't understand where I am going wrong on my last line
firstName = ("Michelle");
String firstName = "Michelle";
console.printf("%s can code in Java!,firstName");
3 Answers
Justin Kraft
26,327 PointsClose the string with a double quote followed by a comma, then the variable name.
console.printf("%s can code in Java!", firstname);
Michelle Mangwiro
Courses Plus Student 467 Pointskk cheers
Grigorij Schleifer
10,365 PointsHi Michelle,
just few modifications.
Task one:
// declare a String variable and initialize (= sign) it to your name
String firstName = "Michelle";
Task two:
// use the console.printf method to write "Michelle can code in Java"
// console is a name of the Console class that has the method printf()
console.printf("Michelle can code in Java");
Task three:
// replace Michelle with %s, this is the required String formatter
// to use the formatter place it where you want your name should be and after " " (not inside) write ("%s some text " , firstName)
console.printf("%s can code in Java", firstName);
I hope I could help you
Grigorij
Michelle Mangwiro
Courses Plus Student 467 PointsThank you
Grigorij Schleifer
10,365 PointsHi Michelle,
can you mark an answer as best? So other could see this post as solved.
Grigorij