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.

Java Java Basics Getting Started with Java IO

Does the last name part not work?

I've tested this adding the last name variable as asked and it works fine in the workspace, but the quiz keeps saying I've failed.

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
String firstName = console.readLine("What is your first name?  ");
console.printf("Hello, my first name is %s.\n", firstName);
console.printf("%s is learning how to write Java.\n", firstName);

String lastName = console.readLine("What is your last name?  \n");
console.printf("%s is my last name.\n", lastName);

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Peter;

Welcome to Treehouse!

It looks like you have the correct idea and general syntax, but your output is not matching with what the challenge engine is attempting to match. Take a look at the formatting that the instructions are wanting and match that same output.

Post back with any further questions.

Ken

Thanks. I guess I was getting ahead of myself and not doing exactly what it said at the time.