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 trialRabab El-Zohbi
1,859 PointsGreat! Now add a field named color of type String that will be used to store the color of the GoKart. Set the value to "
Great! Now add a field named color of type String that will be used to store the color of the GoKart. Set the value to "red"
class GoKart {
string namedcolor="red";
}
4 Answers
Alexander Davison
65,469 PointsFirst off, you need to capitalize the S in string
. Java is picky about capitalization :)
Next, you need to set the name to exactly what the challenge asked you to name it. Instead of naming the variable namedcolor
, you should name it just color
.
Finally, you need to set the value of the variable to what the challenge to what it's excepting it to be. You should set tthe value to "red" and not just an empty string.
I know, I know, code challenges and Java are both picky, but you just have to get used to it.
I hope you understand. ~Alex
Jamal Shiekh
6,440 PointsThe answer is
class GoKart { String color="red"; }
Markie Chancellor
10,809 Pointspublic class GoKart { String color = "red";
}
Heribert Colombo
678 PointsHi there,
Others have already given their point but I'll also like to add mine as currently taking the course.
Answer is:
class GoKart { String color = "red"; }