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

Will Bayley
Will Bayley
500 Points

Java Objects Challenge 1 of 2

The question asked me to add a public method etc.

This is my code, which produces a compiler error.

Please help!

public class GoKart { private String mColor = "red";

public String getColour() { return mColour; } }

GoKart.java
public class GoKart {
  private String mColor = "red";

  public String getColour() {
    return mColour;
  }
}

1 Answer

John Wheal
John Wheal
27,969 Points

You have a typo. You are using the British spelling of Colour and also the American.

Will Bayley
Will Bayley
500 Points

John, thank you. As always with these things, it's so obvious when it's pointed out. I couldn't see the wood for the trees!