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 trial

Java Java Objects Harnessing the Power of Objects Changing State

Stuck

This is the error

com.github.javaparser.ParseException: Encountered " "GoKart "" at line 7, column 10. Was expecting one of: "class" ... "enum" ... "interface" ... "@" ... "@" ... "@" ... "@" ...

at com.github.javaparser.ASTParser.generateParseException(ASTParser.java:9056)
at com.github.javaparser.ASTParser.jj_consume_token(ASTParser.java:8929)
at com.github.javaparser.ASTParser.TypeDeclaration(ASTParser.java:382)
at com.github.javaparser.ASTParser.CompilationUnit(ASTParser.java:185)
at com.github.javaparser.JavaParser.parse(JavaParser.java:111)
at com.github.javaparser.JavaParser.parse(JavaParser.java:133)
at com.teamtreehouse.ast.Inspector.(Inspector.java:41)
at com.teamtreehouse.ast.Inspector.fromSource(Inspector.java:70)
at JavaTester.run(JavaTester.java:66)
at JavaTester.main(JavaTester.java:42)

java.lang.IllegalArgumentException: ParseException: com.github.javaparser.ParseException: Encountered " "GoKart "" at line 7, column 10. Was expecting one of: "class" ... "enum" ... "interface" ... "@" ... "@" ... "@" ... "@" ...

at com.teamtreehouse.ast.Inspector.fromSource(Inspector.java:73)
at JavaTester.run(JavaTester.java:66)
at JavaTester.main(JavaTester.java:42)
GoKart.java
class GoKart {
  public static final int MAX_BARS = 8;
  private String color;

  public GoKart(String color) {
    this.color = color;
  }

  public String getColor() {
    return color;
  }
}

2 Answers

Kirill Dakhnyuk
Kirill Dakhnyuk
7,073 Points

Hi. You forgot to add "int" private int barCount;

That itΒ΄s true,I forgot thamk you for your help