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 trialCaroline Chayadi
531 PointsChallange 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
Treehouse TeacherCaroline;
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
Treehouse TeacherCaroline;
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
Jeff Busch
19,287 PointsHi Caroline,
I copied and pasted your code into the code challenge and it passed. Maybe refresh your browser window?
Jeff
Caroline Chayadi
531 PointsI tried refresh browser, resubmit. Still not working.
When refresh it went blank again. I can't forward my course.
Ken Alger
Treehouse TeacherCaroline;
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
Jeff Busch
19,287 PointsOK, time for desperate measures. Clear the cache and history in your browser.
Caroline Chayadi
531 PointsI 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? ");
Ken Alger
Treehouse Teacheredited for markup
Caroline Chayadi
531 PointsThank you. past it.
Marc Abrate
22,307 PointsI 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.
Suman Adhikari
573 Points <p>String firstName = console.readLine("Gordon");
String lastName = console.readLine("Sumner");
console.printf("Hello %s", firstName);
String band = console.readLine("Which band? "); </p>
```
Suman Adhikari
573 PointsIsn't this code correct? i am nor passing the task though. :( Help me!!