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

Isak Anderson
Isak Anderson
1,084 Points

I'm Stuck on the challenge and I don't know how to get past the error

So the error message says Ensure you use "First name" in your format string. My code is

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

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

console.printf("Hello, my name is %s", firstName);

4 Answers

The challenge is asking you to print ""First name: " and the user's first name."" but you have been printing something else, that is why it sees it as error. It is expecting you to print the sentence it asked from you.

i.e

console.printf("First name: %s", firstName);
Isak Anderson
Isak Anderson
1,084 Points
String firstName = console.readLine("What is your name?  ");
String lastName = console.readLine("What is your last name?  ");
console.printf("Hello, my name is %s", firstName);

You forgot to use camel case in readLine.

Isak Anderson
Isak Anderson
1,084 Points

Thanks for Replying but I did use camel casing in the code I just forgot in the post.. But I used snippets from the previous lesson and I got that to work so I do not know what the problem is..

Can you post your actual code? It is hard to help when you are using another code than the one posted.

Isak Anderson
Isak Anderson
1,084 Points

It Worked!!! Thank you sooo much!!! I really appreciate it.

You are welcome Isak :)