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 trialNaphtali Matione
5,224 Pointsthe usage of %s
at what point do you use %s
1 Answer
Gloria Dwomoh
13,116 PointsWhen you need a placeholder for a string in a sentence. You need a placeholder when you need to replace %s with a string that changes all the time and is not static. For example when you see some log ins in a site they write someone like "Hello, [A NAME]" but that name can change so you can't put a name there by default. To make the name change based on the name of the person who logged in you have to use a place holder to a variable string that holds the name of the user. In Java when you are working with printf you can do that by using %s as a placeholder.
Naphtali Matione
5,224 PointsNaphtali Matione
5,224 Pointsthank you gloria
Gloria Dwomoh
13,116 PointsGloria Dwomoh
13,116 PointsYou are welcome