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)
![Michael Cohen](https://secure.gravatar.com/avatar/7e6d129f3fcc2d4102007bb1e451c3c4?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Michael Cohen
355 PointsWhat is a format string and where do I write this "First Name" that's being asked for? What name do I use?
This is very cryptic and difficult to understand. For instance, Why do certain letters in the middle of words need capitalization?
Is there a glossary of terms and what they mean? This might be helpful as a reference...
// I have imported java.io.Console for you. It is a variable called console.
String firstName = console.readLine("What is your name? ");
String lastName = console.readLine("What is your name? ");
console.printf("Hello my name is Mike", firstName);
console.printf("Mike is learning how to write Java/n", firstName);
1 Answer
![Marcus Parsons](https://uploads.teamtreehouse.com/production/profile-photos/1134502/micro_me3.jpg)
Marcus Parsons
15,719 PointsHi Michael,
Camel casing is just having the first word be lowercase and any following words have a capital starting letter. So, if I said to create a variable using the words your first name and camel case it, you would put "yourFirstName". The challenges tell you what they want you to do, but not how to do it; after all, the job of a programmer is to figure out the how ;)
With that being said, in the 3rd task the challenge tells you to print the string "First name: " and then the user's first name. The user's first name is stored in the variable firstName
. You need to put a formatted string into the printf
command. Use the %s placeholder to insert the variable into the string. Anywhere the Java compiler sees a %s in the string, it is going to replace it with the variable(s) you specify.
console.printf("First name: %s", firstName);
And it's the same concept with dealing with the last name.
Michael Cohen
355 PointsMichael Cohen
355 PointsHi Marcus,
I'm still kinda confused. Where do you put the actual name, like "Mike", as opposed to where you write" firstName"? It seems like the name disappears from the code at some point. Where do we initially specify the name that then get represented by "%s"?
Marcus Parsons
15,719 PointsMarcus Parsons
15,719 PointsI was referencing where you went wrong in your code with that snippet of code I posted. You are right with your creation of the
firstName
andlastName
variables. That little snippet of code belongs in the same place as your firstprintf
command.