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 trialdaniela3
1,554 PointsNeed help with java challenge
I cant figure out both tasks of this question! Could someone comment the finished code so I can learn what I did wrong?
public class GoKart {
private String mColor;
public GoKart(String color) {
mColor = color;
}
public String getColor() {
return mColor;
}
}
2 Answers
Craig Dennis
Treehouse TeacherAhh I see...I think you misread this challenge. In the Example.java, the GoKart class is already created, you just need to create a new
instance and follow the instructions.
Sorry for the delay and the confusion!
Craig Dennis
Treehouse TeacherHmm..nothing jumping out, what is the error?
daniela3
1,554 PointsHi Craig; Here are is the error I was given in the console
./Example.java:1: error: class GoKart is public, should be declared in a file named GoKart.java public class GoKart { ^ JavaTester.java:40: error: cannot access Example Example.main(args); ^ bad source file: ./Example.java file does not contain class Example Please remove or make sure it appears in the correct subdirectory of the sourcepath. 2 errors
daniela3
1,554 Pointsdaniela3
1,554 PointsThanks for your help!