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 trialdusanveljkovic
1,035 PointsI don't see where I am wrong. Can anyone help?
public class GoKart { public static final int MAX_BAR = 8; private String mColor; private int mBarCounter;
public GoKart(String color) { mColor = color; mBarCounter = 0; } public void load(){ mBarCounter = MAX_BAR; }
public String getColor() { return mColor; } }
public class GoKart {
public static final int MAX_BAR = 8;
private String mColor;
private int mBarCounter;
public GoKart(String color) {
mColor = color;
mBarCounter = 0;
}
public void load(){
mBarCounter = MAX_BAR;
}
public String getColor() {
return mColor;
}
}
2 Answers
Dennis Mårtensson
7,400 PointsThis site uses an automated system to correct these tests, and checks to see if it meets certain criteria. It probably searches for the variable 'mBarsCount' and it's uses, so if you name it any different it won't find it. Sure, you could, in theory, name it 'mDonaldDuck' and the program would still compile, but it won't pass this particular automated test. As a rule of thumb, don't change anything you aren't implicitly told to change, and you'll be good. (:
dusanveljkovic
1,035 PointsThanks for answer. I noticed that something is "odd". I am not new to Java and programming, just wanted to check my knowledge and refresh old one, but I noticed that some things are not passing so I was confused. Thanks for clarifying me this.
Jason Anello
Courses Plus Student 94,610 PointsHi Dusan,
The member variable should be mBarsCount
not mBarCounter
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsI think you must have deleted your reply but in your own programs, yes you can name it what you want.
In this case, the challenge gave a specific name that it wanted it to be and it's going to be looking for that name.