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 does it tell me to return to the 1st excercise, even after answering it?

// I have imported java.io.Console for you. It is a variable called console. String FirstName = console.readLine(); String lastName = console.readLine(); console.printf("Hello, type in your", FirstName); console.printf("Hello, type in your", FirstName);

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
String FirstName = console.readLine();
String lastName =  console.readLine();
console.printf("Hello, type in your", FirstName);
console.printf("Hello, type in your", FirstName);

2 Answers

jacksonpranica
jacksonpranica
17,610 Points

Hey Isuma,

I do believe your coding used here is very strange. Here is an example of a clean code for this exercise:

// I have imported java.io.Console for you.  It is a variable called console.
String firstName = console.readLine("Hello, type in your first name: ");
String lastName =  console.readLine("Hello, type in your last name: ");
console.printf("First name: %s", firstName);
console.printf("Last name: %s", lastName);

First of all, your first String variable FirstName has a capital f in the name. This capital F is wrong and invalidates the first challenge. Which is why it keeps sending you back to the first challenge. So please name that string "firstName" without the capital F.

Secondly, the readLine() method can take the string that tells the user to type in their name.

Lastly, the printf() method requires a %s that is used in the string within the method where your String name variables will be inserted.

Leave a comment if you have any other questions!

console.printf ("Thanks a lot Jackson & John!");

Hi, the challenges will (very confusingly) send you back to to a previous question, if you get the next one wrong. It doesn't always do it, but it does it. As long as you haven't changed your previous code, and it passed... just work on the current one till it passes