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 Getting Started with Java Strings, Variables, and Formatting

AYMERIC FIGEROU
AYMERIC FIGEROU
3,748 Points

java.util.MissingFormatArgumentException: Format specifier '%s' ()

Hello TreeHouse Com,

Quite don't get it why there is a message error. My variable has been declared, following by the string formatter %s. It sounds good. or?

Name.java
// I have setup a java.io.Console object for you named console
String firstName="Jaean";
console.printf("%s");
console.printf(" can code in Java");

2 Answers

Christopher Augg
Christopher Augg
21,223 Points

Aymeric,

You should only use one console.printf(). On task 3/3 you are supposed to just alter it to use %s. When formatting a string that includes a variable we do the following:

       String titleOfMovie = "The Shawshank Redemption";
       console.printf("I really enjoyed watching %s", titleOfMovie);

So how would you do it for the challenge?

Hope this helps.

Regards,

Chris

AYMERIC FIGEROU
AYMERIC FIGEROU
3,748 Points

It does indeed. I didn't understand i had to respecify it. If i can say so.

Thanks you