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!
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
Lucy AchesonCourses Plus Student 303 Points
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);
Steve Hunter57,710 Points
You got this, mostly.
You want to assign into
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
printf is fine:
console.printf("First name: %s", firstName);
Does that make sense?