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 trialAndrew Wilkins
492 PointsWhat's the answer for Challenge 4 of 4 for Java Basics?
The string for Which band looks like the others, but it's not correct.
6 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Andrew,
band
hasn't been declared with a data type.
The challenge gives you the hint that it seems to be missing something at the start.
Andrew Wilkins
492 PointsThanks Craig!
I'm enjoying the course a lot, by the way.
Andrew Wilkins
492 PointsHi Jason, thanks for replying...
Yeah! I thought defining it as a String was all it wanted:
String band = console.readLine("Which band? ");
Do I need another line of code?
Jason Anello
Courses Plus Student 94,610 PointsNo that should be it. Try refreshing the challenge. It's rare but sometimes they don't pass with correct code.
This is what passed for me: String band = console.readLine("Which band? ");
I don't see any difference.
Andrew Wilkins
492 PointsI ran through it half a dozen times, and tried it in a new browser... it still didn't work. Let me know if you have other suggestions.
I sent a screenshot over to: help@teamtreehouse.com.
Thanks~
Craig Dennis
Treehouse TeacherHi Andrew!
I just ran through it and added the String declaration to the line in Task 4 of 4. It worked for me, I'll take a look at your screenshot, sorry for the frustration. I'll get to the bottom of it.
Craig Dennis
Treehouse TeacherI see your screenshot! You broke my mock code I use for testing ;)
You added console.readLine
to the first and second lines and it didn't need it, those should just remain as the strings you had.
I will update my mock to allow for that, and sorry for the frustration.
Let me know if you have any more problems.
Andrew Wilkins
492 PointsTook several more tries, but i finally got through it! Thanks!
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHere's the entire code I used:
Can you post the entire code you have that you're trying to pass task 4 with?