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 trialDaniel Bochardt
Courses Plus Student 542 PointsHi everyone, I am getting and error on this code Error: " Bummer! Please make the field mEnergyLevel public"
I am getting an error on this code Error: " Bummer! Please make the field mEnergyLevel public"
I have compared it with other people's solutions and it still doesnt work. I tried to change the 4th line to public int mEnergyLevel; but it still did not work.
"Help me obi wan kanobi... your my only hope!"
public class GoKart {
public static final int MAX_BARS = 8;
private String mColor;
private int mEnergyLevel;
public GoKart(String color) {
mColor = color;
mEnergyLevel = 0;
}
public void load(){
mEnergyLevel = MAX_BARS;
}
public String getColor() {
return mColor;
}
}
1 Answer
Harry James
14,780 PointsHey Daniel!
You were close with the challenge - it's just you seem to have misread the second question! On task 2, it asks you to name the variable mBarsCount
but you named it mEnergyLevel
.
- Change the variable mEnergyLevel to mBarsCount both at its declaration and initialization (In the constructor) and the challenge should pass.
Let me know how it goes! If you get any more problems along the way, give me a shout and I'd be happy to help out :)