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 IO

My code works fine in the workspace but is not completing the challenge.

String firstName = console.readLine ("What is your name?");

String lastName = console.readLine ("What is your last name?");

 console.printf("%s\n", firstName);
    console.printf("%s\n", lastName);

What am I missing here?

That still wouldn't help. I am getting the error

Bummer! Ensure you use "First name" in your format string.

3 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Take a look at the instructions one more time:

Print out to the screen using the printf method on console, "First name: " and the user's first name.

HINT: The results of what you have there is just the value in the firstName variable. It seems to be missing a label.

Wow......

that was much easier than I was making it out to be

console.printf("First name: %s", firstName);

I was just missing the First name: in my string....

Thank you for making me read the task.

Try leaving two spaces after the question marks and a period after the %s's

String firstName = console.readLine ("What is your name?");

instead of this Try String firstName = console.readLine ("What is your First name?");

I also tried this with no luck. I am not sure exactly what they are looking for in this challenge I mean this program will run correctly.