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 (Retired) Meet Objects Privacy and Methods

The code is not passing for this Challenge even though it is correct?

Hi, I am trying to do this challenge and my code is as follows:

public class GoKart { public String mColor = "red"; } public String getColor() { return mColor; }

I am sure that this code is correct, but cannot understand why it is passing. Plus, I understand the "string" part is not capitalised, I am just trying different things.

GoKart.java
public class GoKart {
  public String mColor = "red";
}
public String getColor() {
  return mColor;
}

1 Answer

Got it Sorted! Had not placed the getter within the class... GRRR IT's monday people... (is that some sort of a valid excuse!)

Haha! Yes, Mondays cause bugs - known fact! ;-)