"Java Data Structures - Retired" was retired on May 31, 2019. You are now viewing the recommended replacement.

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 is it saying this Did you forget to pass the `lastName` parameter to the printf function?

I have added last name exactly how I added first name but it wont accept it?

IO.java
// I have imported java.io.Console for you.  It is a variable called console.String firstName= console.readLine(β€œWhat is your name?  β€œ);
String firstName= console.readLine("What is your name?  ");
console.printf("Hello, my name is %s\n", firstName);
console.printf("%s can code in Java\n", firstName);
console.printf("%s is learning how to write  Java\n", firstName);
String lastName= console.readLine("What is your last name?  ");
console.printf("Hello, my name is %s\n", lastName);
console.printf("%s can code in Java\n", lastName);
console.printf("%s is learning how to write  Java\n", lastName);
console.printf("First name %s\n", firstName);
console.printf("Last name %s\n", lastName);
Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Moderator Note:

I've deleted the duplicate question you posted prior to this one. Please try to refrain from posting multiple threads for the same topic / question.

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Emma,

You're doing fine. You just have way too much code there. The 4 tasks for the challenge are only asking for 4 things, so there should be only 4 lines of code.

Instructions must be followed exactly and in the order they are given. If you add code not asked for, deleted code that you weren't told to, or modify preloaded code without instructions to do so, the code checker will return the Bummer even if it's functioning code.

You have all the correct code for the challenge but also 6 lines of code that are not asked for. Restart the challenge and pay close attention to what the instructions are asking for. Only do those... nothing else.

Otherwise, very nice work!! :) :dizzy: