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 trialRobert Roberson
Courses Plus Student 8,401 PointsI can always manage to pass the quizzes and the exercises in the classes. However the workspace is a total Catastrophe!
I go over things line by line and they look almost the same but for some reason and equal sign will be red not black, the the or lines don't work some reason. I am about to give up honestly.
public class GoKart {
private String mColor;
public GoKart(String color) {
mColor = color;
}
public String getColor() {
return mColor;
}
}
2 Answers
Kristian Terziev
28,449 PointsAlright, judging by your code, you're stuck on step 1 of the challenge, am I right. So they want you to create a constant that is accessible from the class and not just an instance of it. So if you've listened carefully to Craig, you should know these two things:
A variable is constant and cannot be change if it's preceded by the keyword "final". Meaning once it is initialized it will never be changed again. Note that it's accepted that constants should be with capital letters only.
A variable is accessible from the class (ant not only the instance) when it is preceded by the keyword "static"
Therefore, when you add the modifier -> "public" and the type -> int, your code should be something like this:
public static final int MAX_ENERGY = 8;
Robert Roberson
Courses Plus Student 8,401 PointsNo that not what I am talking these exercises, I can do with ease. It is inside the workshop launch workshop. I actually stopped doing the workshop long ago but it is frustrating not to be able to make them work. But thank you for the effort.
Seth Kroger
56,414 PointsCan you share a snapshot of your workspace with us? Go to the three icons in the upper right of the workspace. Click on the first one that looks like a camera then click Take Snapshot and post the link here.