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

IO challenge

what am I doing wrong?

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
String firstName= console.readLine ("Shayan");
String lastName= console.readLine ("Asgari");
console.printf( "firstName", Shayan);

1 Answer

Hey Morgan,

You shouldn't pass any arguments to the readLine methods. The reason being that you're taking input from the user, not passing in any by yourself. Then, make sure you use %s when passing in the firstName variable in your print statement. It's also important to note in this case that the test statement may be looking for, "First name: <firstName>", so be sure to follow the instructions specifically.

String firstName = console.readLine();
String lastName = console.readLine();
console.printf("First name: %s", firstName);

thank you very much. I did not realize that a colon had to be added. I thought the First name in the question referred to firstName. Thanks again