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!
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 trial

Ivan Gadza
1,543 PointsI dont understand whats wrong in my code.
public class GoKart { public static final int BATTERY_MAX = 8; private String mColor; int mBattery;
public GoKart(String color) { mColor = color; mBattery = 0;
} public void load() { mBattery = BATTERY_MAX;
public String getColor() { return mColor; } } this is the code and this is the error i get
./GoKart.java:14: error: illegal start of expression public String getColor() { ^ ./GoKart.java:14: error: ';' expected public String getColor() { ^ ./GoKart.java:17: error: reached end of file while parsing } ^ ./GoKart.java:15: error: cannot return a value from method whose result type is void return mColor; ^ 4 errors
2 Answers

Steve Hunter
57,710 PointsIt is difficult to read the code like that, but I think you may be missed a closing curly brace to close out the public void load()
method.
public class GoKart {
public static final int BATTERY_MAX = 8;
private String mColor;
int mBattery;
public GoKart(String color) {
mColor = color; mBattery = 0;
}
public void load() {
mBattery = BATTERY_MAX;
} // <<< This is missing??
public String getColor() {
return mColor;
}
}

Ivan Gadza
1,543 PointsYes I know its hard to read,thank you very much!!