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 trialChris Jones
4,521 PointsErrors in the creating classes exercise?
Unsure where the errors are in my code. Says that you cannot start an expression with public and that cannot be correct.
public class GoKart {
public static void main (String[] args) {
public String color = "red";
}
}
3 Answers
jordans
1,609 PointsThe string color doesn't have to be public.
Grigorij Schleifer
10,365 PointsMaybe this way ....
public class GoKart {
public static void main (String[] args) {
String color = new String ("red");
}
}
Chris Jones
4,521 PointsOk I went back to refactor the code and it didn't want me to specify the public static void main line. It also asked me to use the member field specifier
String mGoKartColor = "red";
Chris Jones
4,521 PointsChris Jones
4,521 PointsEven when I take it out it doesn't pass.
Craig Dennis
Treehouse TeacherCraig Dennis
Treehouse TeacherWhat's the new error?
jordans
1,609 Pointsjordans
1,609 PointsIt worked fine for me.