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

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.