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 Objects Meet Objects Create a class and field

Rabab El-Zohbi
Rabab El-Zohbi
1,859 Points

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 "

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"

GoKart.java
class GoKart {
  string namedcolor="";
}

I don't see what's wrong with double-posting... How is it wrong?

Hi Alex, In my opinion it is considered bad practice, as it doesn't add any value to the discussion when there are two topics from the very same author, the very same content and the very same title. Rather, it diffuses answers between the two topics and confuses people. I generally think that in this community double-posting isn't very welcome, but I might be wrong. Best Regards, Philip

1 Answer

First 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. :smile:

I hope you understand. ~Alex