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

Selvio Perez
Selvio Perez
5,694 Points

This is not suppost to print out the user's first name?

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

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
String firstName = console.readLine( "Tell me your first name      ");
console.printf("Hello %s\n", firstName);
console.printf("$s you are doing it great man\n",firstName);
String lastName = console.readLine( "Tell me your last name      ");
console.printf("Hello %s\n", lastName);
console.printf("%s you are doing it great man\n",lastName);

String firstName = "Guy";
console.printf("Hello %s\n", firstName);

2 Answers

Hi Selvio,

When it comes to challenges, try to stick to what it asks you to do. This should be all the code you have:

// I have imported java.io.Console for you.  It is a variable called console.
String firstName = console.readLine("What is your first name? ");
String lastName = console.readLine("What is your last name? ");
console.printf("First name: %s", firstName);
console.printf("Last name: %s", lastName);
Selvio Perez
Selvio Perez
5,694 Points

Thank you so much marcus

You're welcome, and don't get me wrong, I like that you're adding extra lines to make it more personal, but challenges are generally very specific about what they want. Cheers Selvio! Happy Coding!