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 trialAndrew Li
4,251 PointsI got a weird error message but cant figure out what I did wrong here.
Bummer: java.lang.IllegalArgumentException: ParseException: com.github.javaparser.ParseException: Encountered " "=" "= "" at line 4, column 27. Was expecting one of: <IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ... (Look around Inspector.java line 73)
The above is the error I got for my code:
class GoKart { private String color;
public static final int = MAX_BARS=8;
public GoKart(String color) { this.color = color; }
public String getColor() { return color; }
}
Not entirely sure what I did wrong
class GoKart {
private String color;
public static final int = MAX_BARS=8;
public GoKart(String color) {
this.color = color;
}
public String getColor() {
return color;
}
}
2 Answers
saykin
9,835 PointsYour error is in this line of code
public static final int = MAX_BARS=8;
You have two equal characters, as it says in the error.
The syntax for setting variables in Java is <type> <name> = <value>
I could get why the error message is very confusing, if it doesn't make sense, check which line the error/exception happened. In this case, line 4.
Andrew Li
4,251 PointsOh darn! :D
Well spotted, thank you. I was so confused too,