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

Everything looks right... but when I submit it, it keeps asking if I forgot to include the first name function.

My code format matches everything I did successfully in my workspace. I am perplexed at why it is not reading the firstName variable I've put in the console.printf it keeps saying it's missing but it isn't.

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
String firstName = "Sally";
String lastName = "Jones";
  console.readLine(firstName);
  console.readLine(lastName);
  console.printf("First name: %s", firstName);

I solved it :) It was easy once I took a step back and realized I missed most of the video! I had come back to the course and didn't realize I had missed a step.

// 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);

Mark Miller
Mark Miller
45,831 Points

The challenge says to assign the user's input as the value of first and last names. You must use the = sign to assign the user's input to be the values of your two Strings.

String firstName = console.readLine();

You don't need anything in the parenthesis, but I think you may have the choice of typing in a prompt for the user.

1 Answer

I solved it :) It was easy once I took a step back and realized I missed most of the video! I had come back to the course and didn't realize I had missed a step.

// 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);