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 Meet Objects Add a Getter

Kasey Domer
Kasey Domer
787 Points

Question on method lesson

I'm getting this massive error: java.lang.IllegalArgumentException: ParseException: com.github.javaparser.ParseException: Encountered "<EOF>" at line 6, column 1. Was expecting one of: "abstract" ... "boolean" ... "byte" ... "char" ... "class" ... "default" ... "double" ... "enum" ... "final" ... "float" ... "int" ... "interface" ... "long" ... "native" ... "private" ... "protected" ... "public" ... "short" ... "static" ... "strictfp" ... "synchronized" ... "transient" ... "void" ... "volatile" ... <IDENTIFIER> ... "{" ... "}" ... ";" ... "@" ... "<" ... (Look around Inspector.java line 73)

I'm pretty sure I understand this. I even referred back to my own workspace (containing code that compiles and runs properly) to try and figure it out, but is there something I'm missing?

GoKart.java
class GoKart {
  private String color = "red";

   public String getColor() {
     return color;
  } // <- I added this
}

2 Answers

Hi Kasey,

You haven't closed your method with a closing } - I'll put a comment in your code.

The error, ParseException: Encountered "<EOF>" at line 6 means that the compiler got to the end of the file before it was expecting to. If you see this error, it usually means you've missed out a closing curly brace, or have some other error involving the number of braces in your code.

Steve.

Kasey Domer
Kasey Domer
787 Points

Oy vey... you've answered two of my dumb questions in a row now, haha. Thank you!

There's no such thing as dumb questions! We're all here to learn. Keep it up! :smile: :+1: