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

Sohaib Rashid
Sohaib Rashid
627 Points

In task 4 it says Oops! Task 3 is says no longer passing! What should I do?

Task 4 should have a similar answer to task 3 and if not then what should it be?

IO.java
// 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("Last name: ", lastName);

What are they asking you do to in both tasks?

Sohaib Rashid
Sohaib Rashid
627 Points

Print out to the screen using the printf method on console, "Last name: " and the user's last name. - Task 4 Task 3 asked to the same exact thing but with the first name, so i thought just substituting it with the last name would work because task 3 initially worked fine, until i did substitute it and it said Oops! Task 3 is no longer passing

2 Answers

Allie O.
Allie O.
11,601 Points

The tasks build on top of one another. So to pass task 4, you should still keep the code for task 3. That means you need two separate lines of code to print out first name, and the last name. Hope this helps.

Sohaib Rashid
Sohaib Rashid
627 Points

It worked now, thank you for your help!