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 trialJoseph Nickalo
432 PointsDid you not name the field mBarsCount perhaps?" Is that what it wrong about this? How do I do that hehe
The title
public class GoKart {
private String mColor;
public static final int MAX_BARCOUNT = 8;
public GoKart(String color) {
mColor = color;
}
private GoKart (int mBarsCount) {
mBarsCount = 0;
}
public String getColor() {
return mColor;
}
}
1 Answer
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHey there Joseph,
What the challenge is expecting you to do is first create it as a private variable of the class, the way it's set up now it only exists inside the scope of the GoKart constructor.
try first declaring the private variable at the top, but don't give it a value, we set that to 0 in the constructor.
so, something like below should do the trick.
public class GoKart {
private String mColor;
public static final int MAX_BARS = 8;
private int mBarsCount;
public GoKart(String color) {
mColor = color;
mBarsCount = 0;
}
public String getColor() {
return mColor;
}
}
Thanks, I hope this helps. If not feel free to let me know and I'll try to further help.