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 trialMit Sengupta
13,823 PointsHello, can anyone tell me what's wrong with my code?
This is what I wrote : console.printf(firstName +" can code Java");
// I have setup a java.io.Console object for you named console
String firstName = "Mit";
console.printf(firstName +" can code java");
1 Answer
Shawn Kobb
4,889 PointsWith the caveat that I'm just as new at this as you, I think you want to use a variable.
I believe it should be:
console.printf("%s can code java", firstName);
This should cause java to replace the variable "%s" with the String firstName (i.e. Mit).
I hope this helps.