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 trialTim McKyer
10,989 PointsAnybody know where I went wrong here?
Not quite sure where I went wrong here lol a little help would be greatly appreciated. :)
public class GoKart {
private String mColor;
public static final int MAX_BARS = 8;
private int mBarsCount;
public GoKart(String color) {
mColor = color;
mBarsCount = 0;
}
public String getColor() {
return mColor;
}
public void charge() {
mBarsCount = MAX_BARS;
}
2 Answers
Craig Lovell
5,752 PointsLooks like your charge() method is missing its closing curly brace.
Craig Lovell
5,752 PointsNo, but I am learning ios and swift right now on this website. But, I already have a lot of experience with Java from working with it in collage (as well as c, and c++). Once you get thing hang of a few c style languages its pretty easy to pick up new ones.
Tim McKyer
10,989 PointsNice, I wish I started off that way I hear people say if you can code in C and C++ you can code in just about anything. But any advice on how to get a good understanding of java for someone who is looking to get into android development?
Craig Lovell
5,752 PointsIt seems like your on the right track. Java is similar in a lot of ways to C, so if you are able to get a good understanding of that you should be able to learn other languages pretty easily. However I still think learning C is valuable because it gives you greater insight into why things are done certain ways. For example if you have ever wondered why arrays start at the index of 0, then learning C will give you a better insight since you can add to an array pointer to move to the next address in memory.
Like: int numbers[] = {1,2,3,4}; printf("The number %i\n, *(numbers + 2)); // will print 3
You can see that *(numbers + 2) is a lot like numbers[2]. Where 2 is an offset as far as the number of address spaces to move.
Hopefully I didn't just confuse you, but if you learn a language like C then you will learn little things like that. However learning Java will definitely take you a long ways. So just keep at it. It will eventually all start to make sense.
Tim McKyer
10,989 PointsI see what you are saying there thanks for the help man have a good one.
Tim McKyer
10,989 PointsTim McKyer
10,989 PointsI cannot believe I missed that lol thanks for the help man haha I've been up too late xD
Craig Lovell
5,752 PointsCraig Lovell
5,752 PointsIts fine man, it happens to everyone eventually.
Tim McKyer
10,989 PointsTim McKyer
10,989 PointsCool man are you a Mobile developer?