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 trial

Java Java Basics Using your New Tools Multiple Format Strings

Thomas Minnick
Thomas Minnick
2,539 Points

This challenge is asking me to use the %s formatter but when I do it tells me that I forgot to use it.

when I run this it tells me "Looks like you didn't use '%s' formatter"

Multiple.java
// I've imported java.io.Console for you.  It is stored in a variable called console for you.
String name = console.readLine("Whats, Your Name?");
String pastTenseVerb = console.readLine("Past tense verb");
System.out.printf("%s really %s this excercise",name);
Thomas Minnick
Thomas Minnick
2,539 Points

on the last line I had System.outprintf("%s really %s this exercise",name ,pastTenseVerb); idk why it didn't add that but it still doesn't work.

1 Answer

Hi Thomas,

I got through the challenge with code very similar to yours. You've identified why your first post didn't work as you needed to include two variables as you used two %s in your string.

The second post, doesn't have a dot between out and printf. However, I used console.printf and that worked fine. Also, the challenge output might be expecting a precise string and you've typod the word exercise in the first post and missed a word out in the second.

This worked for me:

String name = console.readLine("What is your name?: ");
String pastTenseVerb = console.readLine("Enter a past tense verb: ");
console.printf("%s really %s this coding exercise", name, pastTenseVerb);

Steve.

Thomas Minnick
Thomas Minnick
2,539 Points

Thanks it didn't like the system.out.printf changing it to console.printf solved the issue

Glad you got it sorted. :+1:

Steve.