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

Why isn't this code working?

What does the parameter thing mean?

// I have imported java.io.Console for you.  It is a variable called console.
String firstName = "Lucy";
  console.readLine("my name is %s", firstName);
String lastName = "Acheson";
console.readLine("My last name is %s", lastName);
console.printf("First Name: %s", firstName);

1 Answer

Hi there,

You got this, mostly.

You want to assign into firstName using console.readLine - that looks like:

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

This takes user input and stores that in the variable. If you hard-code your name into the (or fail to store user input in there), the challenge tasks won't pass. Those tests will be sending input to the readLine method, then expecting that input to be output at the end of the challenge

Your printf is fine:

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

Does that make sense?