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 Using your New Tools Fix the Errors

Challange Task 4 of4

I got this error message and I cant seems to fix it.

Bummer! Make sure you capture the results from the readLine in the String band

My code is String band = console.readLine ("Which band? ");

9 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Caroline;

Sometimes the challenge verification system is, um interesting, at lets things pass that it shouldn't, but this is what the challenge is looking for:

Uncomment the lines and fix the errors.

// Sting firstName = "Gordon";     => TASK 1 
String firstName = "Gordon";

// string lastName = "Sumner";     => TASK 2
String lastName = "Summer";

// console.printf("Hello %s", firstName)     => TASK 3
console.printf("Hello %s", firstName);

// band = console.readLine("Which band?  ");     => TASK 4
String band = console.readLine("Which band?  ");

Once a task is completed, you don't need to change it again for the next tasks... at least on this challenge.

Hope it helps,

Ken

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Caroline;

Welcome to Treehouse Island!

The code you posted above:

String band = console.readLine ("Which band? ");

worked just fine for me for Task 4 of the challenge. Perhaps try to resubmit it.

Ken

Hi Caroline,

I copied and pasted your code into the code challenge and it passed. Maybe refresh your browser window?

Jeff

I tried refresh browser, resubmit. Still not working.

When refresh it went blank again. I can't forward my course.

Ken Alger
Ken Alger
Treehouse Teacher

Caroline;

When you refresh your browser it resets the challenge and you have to complete it again from the start. Fortunately this challenge is not too typing intensive.

Have you worked your way back to Task 4? For that task all you really have to do is to add String to the beginning of the last line after uncommenting it.

Let us know if you are still stuck, your code looks good though.

Ken

OK, time for desperate measures. Clear the cache and history in your browser.

I did that and still no luck,

I use different browser and different computers. here is my code

// Sting firstName = "Gordon";
String firstName = console.readLine("What is your first name? ");
// string lastName = "Sumner";
String lastName = console.readLine("What is your last name? ");
// console.printf("Hello %s", firstName)
console.printf("Hello %s", firstName );
// band = console.readLine("Which band?  ");
String band = console.readLine("Which band? ");

Thank you. past it.

Marc Abrate
Marc Abrate
22,307 Points

I had the same problem.

I was replacing the "Gordon" and "Summer" with console.readLine(). I wonder if that had anything to do with it. But, I copied the code above and it worked.

            <p>String firstName = console.readLine("Gordon");

String lastName = console.readLine("Sumner");

console.printf("Hello %s", firstName);

String band = console.readLine("Which band?  "); </p>
            ```

Isn't this code correct? i am nor passing the task though. :( Help me!!