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.

Zamy Khan
Courses Plus Student 953 PointsChallenge 2 task 2 'Now change the color field to be private by adding the access level modifier.'
i have attempted the question many times with this code but i always comes with syntax errors.
public class GoKart { public String mColor = "red";
public String getColor() {
return mColor; }
}
public class GoKart { private String mColor = "red";
public getColor() { return mColor; }
public setColor(String color){ mColor = color;}
3 Answers

Ricky Sparks
22,249 Pointspublic class GoKart { private String mColor = "red"; public String getColor() { return mColor; } }

William Dalessi
1,266 PointsExamples and answers to the exercises would be helpful, and save everyone a lot of time!

Craig Dennis
Treehouse TeacherThe instructions are asking just for the color field to be marked private (instead of public).
Other code is looking pretty good, you just got ahead of the challenge ;)
Hope it helps!
Ricky Sparks
22,249 PointsRicky Sparks
22,249 Pointsadd String to getColor and erase the last line of code it is not needed public setColor(String color){ mColor = color;}