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 trialEugenio Diaz
1,765 PointsI dont understand the question or how to do it. Could anyone explain? I am getting desperate.
Add a public method, or getter, that can be used to get the color of the go kart.
anyone??
Eugenio Diaz
1,765 PointsVery nice forum! Very helpful, and you get he responses very fast!
3 Answers
Vrund Patel
11,994 PointsYou need to create a method so that you can only get the value back and cannot change the value.
public class GoKart {
public String mColor = "red";
public String getColor(){
return mColor;
}
}
After that you need to make the instance private so it will be immutable
private String mColor;
Hope this helps!
Eugenio Diaz
1,765 PointsThanks a lot!
Devin Scheu
66,191 PointsShould look something like this:
public getGokart() {
return [Object]
}
Eugenio Diaz
1,765 PointsThank you very much! I was confused at first but now i get it!
Nick Janes
5,487 PointsNick Janes
5,487 PointsI'd just like to remind you not to hesitate to ask questions. We are here to help and we enjoy doing it. (: