Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

kimberli Broadus
3,197 PointsUsing the console's printf method, display a message that says, "First name: ", followed by the first name that the user
How should this be written
// I have imported java.io.Console for you. It is a variable called console.
String firstName = console.readLine("Kimberli");
String lastName = console.readLine("Broadus");
String firstName = console.printf("Kimberli");
2 Answers

cm21
150,854 PointsHi Kimberli,
1) There's no need to declare firstName again. In fact, the Java compiler won't allow the variable to be declared more than once.
2) You'll need to use a placeholder, known as a formatter, to follow the printf method's syntax rules for telling the Java compiler that you have a string variable you want to print out. You'll want to use the %s string formatter, and after a comma, state which string variable you want to print out.
// I have imported java.io.Console for you. It is a variable called console.
String firstName = console.readLine("Kimberli");
String lastName = console.readLine("Broadus");
console.printf("First name: %s", firstName);
You'll be writing something similar to that last line for step 4.
Hope this helps!

kimberli Broadus
3,197 PointsThank you, CJ
Rohit Tolawat
8,277 PointsRohit Tolawat
8,277 PointsString firstName = console.readLine("Enter your first name:"); console.printf("First Name: %s \n",firstName);
/* Do the above and I think your issue would be solved */