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!
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 trial
I am constantly getting the "Ensure you included the string formatter '%s'" error, is my syntax incorrect?
From my knowledge this is used properly but is erroring out, have I made a mistake I cannot spot?
// I have imported java.io.Console for you. It is a variable called console. String firstName = console.readLine(); String lastName = console.readLine(); console.printf(String.format("First name: %s",firstName));
Matthew Hardy4,063 Points
The method printf allows for a formatted string to be directly entered into it, you have no need for String.format. Simply typing console.printf("First name: %s",firstName); will get the job done with no problems!
Jason AndersTreehouse Moderator 145,855 Points
I'm not sure why you added
String.format() to the
console.printf() call. "printf" itself is used to print a formatted string. So, just delete that extra code and you're good to go.
console.printf("First name: %s",firstName);
Keep Coding! :)