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 trialWilliam Dalessi
1,266 PointsNow change the color field to be private by adding the access level modifier.
Well does anyone have the solution to this problem.
I do not understand the question, and therefore am completely unable to solve the problem.
These lessons move to fast to learn everything they are talking about.
public class GoKart {
public String mColor = "red";
public String getColor() {
return mColor;
public class GoKart { private String mColor = "red"; public String getColor() { return mColor; } }
}
}
4 Answers
William Li
Courses Plus Student 26,868 PointsFor this challenge, in this line public String mColor = "red";
, all you need to do is change public
to private
.
public class GoKart {
private String mColor = "red";
public String getColor() {
return mColor;
}
}
Jamal Shiekh
6,440 PointsThe answer is: only add private with lowcase.
class GoKart { private String color = "red"; }
glen turner
509 PointsNone of these seem to work.
Muhammad Asif
Courses Plus Student 557 Pointsclass GoKart { private String color = "red"; public String getColor() { return getColor(); } }
Jamal Shiekh
6,440 PointsJamal Shiekh
6,440 PointsThe answer is: only add private with lowcase.
class GoKart { private String color = "red"; }