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 trialJoseph Saika
2,648 Pointscreating constants in a code
how do you create a constant in code
class GoKart {
public static final int MAX BARS GOKARTS = 8;
final private String color;
public GoKart(String color) {
this.color = color;
}
public String getColor() {
return color;
}
}
4 Answers
Joseph Saika
2,648 Points....thanks very much most appreciated
Stanley Thijssen
22,831 PointsYou can not have spaces in your variable names. The right naming convention in this case will be: MAX_BARS
.
Joseph Saika
2,648 Points... the code is showing errors
Daniel Turato
Java Web Development Techdegree Graduate 30,124 PointsStand naming conventions for constants are as followed : MAX_BARS_GOCARTS . So, the name needs to be capitalised with underscores separating individual words