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 trialKern Tallett
10,012 PointsPlease make the field Public: I can't see where I have gone wrong. Any help is much appreciated.
I am getting an incorrect with a please make the mBatteryCount public. I thought I had made it accessible yet not changeable. I can't see the error I am making.
public class GoKart {
public static final int MAX_BATTERY = 8;
private String mColor;
private int mBatteryCount;
public GoKart(String color) {
mColor = color;
mBatteryCount = 0;
}
public void load() {
mBatteryCount = MAX_BATTERY;
}
public String getColor() {
return mColor;
}
}
1 Answer
Dan Johnson
40,533 PointsThe challenge is confused about the names you're using. mBatteryCount should be mBarsCount and the method load should be charge.
The actual logic looks fine though, so that should be all you need to change.
Kern Tallett
10,012 PointsKern Tallett
10,012 PointsThanks Dan. It worked, I followed what I learned from the pez example too closely and ignored the possibility other areas may need a change.