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 trialcoder5837
1,535 PointsI'm not really sure what this question wants me to do
How do I make it public inside of private?
public class GoKart {
private String mColor = "red";
public Color(String mColor){
mColor = color
}
public String getColor() {
return mColor;
}
}
1 Answer
Chase Marchione
155,055 PointsHi again,
1) Your public Color method should be a public GoKart method (your constructor method should have the same name as the class it is declared in--since constructors create objects from the class's blueprint.)
2) The parameter of this GoKart method should be different than 'mColor'; we are going to set the mColor variable that you already declared to the value of a new variable (in my example, I named the parameter 'color'.)
3) You will want to add a semicolon at the end of your 'mColor = color' statement, so that the compiler knows that statement is over.
public GoKart(String color) {
mColor = color;
}
Hope this helps!
coder5837
1,535 Pointscoder5837
1,535 PointsThanks again! I'm really not the best at Java!