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

Task 1 no longer passing

Question: Declare another variable, naming this one the camel-cased version of "last name". Use console.readLine to store the user's last name into this new variable.

My ans: String lastName = console.readLine("lastName");

What it keeps saying "task 1 no longer passing even after I answered it correctly"

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

3 Answers

andren
andren
28,558 Points

You seem to have changed/removed the code you wrote during task 1. When doing challenges with multiple tasks you have to keep the code from previous tasks around, if you don't you will usually not be allowed to proceed further.

Task 1 asked you to prompt the user for a first name, if you add that code back like this:

// I have imported java.io.Console for you.  It is a variable called console.
String firstName = console.readLine("firstName"); // Code from task 1
String lastName = console.readLine("lastName");

Then your code will pass task 2.

Thank you for your reply, but that does not seem to be the issue. I am keeping task one and still getting the same message.

andren
andren
28,558 Points

That's odd. I did test the code I posted before making my reply and the challenge did accept it. You could try restarting the challenge (using the "Restart" button) and then just copy and pasting in the code I posted above. If there is some sort of bug going on that usually fixes things.

Thank you, for your willingness to help. Actually, the problem was that I was supposed to keep task one the console when doing task 2.