Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

harun west
1,732 PointsFinally, since the color is being set in the constructor now, remove the initialization from the field definition...
Finally, since the color is being set in the constructor now, remove the initialization from the field definition. Just leave it declared, but not initialized to "red".
I have absolutely no idea what this means. What is meant by "field", "initialization" and "declared"?
class GoKart {
private String color = "red";
//constructor
public GoKart(String color){
this.color = "red";
}
public String getColor(){
return color;
}
}
2 Answers

Fahad Mutair
10,359 Pointshi harun west ,
remove the initialization from the field definition
which means
private String color;

cherishli
654 PointsHey for anyone looking for help in 2020, here it goes. Just developing on Fahad's point:
You need to change the initial answer of: private String color = "red";
In the second line to -
private String color = "color";
Hope that helps.
harun west
1,732 Pointsharun west
1,732 PointsThank you for the answer Fahad. I changed private String color = "red"; to private String color;
but it still says color is still being assigned in the field declaration...?
Fahad Mutair
10,359 PointsFahad Mutair
10,359 Points