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 trialLaura Mckay
599 PointsForgot to use %s formatter, but am using it!
String name = console.readLine("Enter your name: "); String pastTenseVerb = console.readLine("Enter your adjective: "); System.out.printf("%s really %s", name, pastTenseVerb);
Getting error "Looks like you forgot to use %s formatter"
String name = console.readLine("Enter your name: ");
String pastTenseVerb = console.readLine("Enter your adjective: ");
System.out.printf("%s really %s", name, pastTenseVerb);
1 Answer
andren
28,558 PointsThe error message that the code checker produces can often be misleading, in reality your code is perfectly fine.
The code checker for these challenges can be quite picky, not just about the result of your code but the way the program is coded. The test for the third task involves the code checker looking for a console.printf()
command with two %s
placeholders in it. Since you use System.out.printf()
instead of console.printf()
that ends up confusing the code checker, even though in reality the two commands do the same thing.
So all you need to do to fix this issue is to change the System.out.printf()
to console.printf()
instead.
Also for future reference it's worth noting that the challenge checker will often mark your code as wrong if the string you print does not match the example provided to the letter, that is not the case in this challenge but it's worth keeping in mind. I mention this due to the fact that the string you are printing in your solution is actually not a complete match with the string that was requested.
Laura Mckay
599 PointsLaura Mckay
599 PointsWow! I can't believe I missed that! The workspace doesn't work properly so have been running code through Intellij and am so used to writing System.out, I didn't even notice! What a dafty! Thanks a lot! :)
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsHi Laura Mckay
Please, don't forget to close out the post by marking the response as Best Answer if it answered your question to your satisfaction. This helps keep the Community Forums up-to-date.
Thanks & Keep Coding!
Jason - Treehouse Community Moderator