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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Kevin Gresmer](https://secure.gravatar.com/avatar/d2195a1afbc8009792c1450699cc9187?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Kevin Gresmer
3,020 PointsComplete this code. We want to format the 'jokeText' String to include the value of the 'animal' variable.
Complete this code. We want to format the 'jokeText' String to include the value of the 'animal' variable. 'jokeText' already has the appropriate placeholder.
String animal = "monkey"; jokeText = String.format( ???, ??? ); mTextView.setText(jokeText);
This seems like a simple question. Maybe I am missing something with this concept.
I think the answer should be %1$s, animal, but this is incorrect. Can someone explain this to me?
Thanks,
1 Answer
![Dan Johnson](https://secure.gravatar.com/avatar/ccdac3c69acdf377785b8454bc481df6?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Dan Johnson
40,533 PointsIt mentions that 'jokeText' already contains the placeholder, which means it's setup as the format string. If we pretend it looks like this:
String jokeText = "Animal: %s";
Then we could insert the String 'animal' into it like this:
jokeText = String.format(jokeText, animal); //This would produce the String, "Animal: monkey"