Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Objects Meet Objects Access Modifiers

how do i Add the proper access level modifier to the color field to ensure it's privacy.

plz help

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

  public String getColor() {
    return mColor;

3 Answers

Hi Austen,

You only needed to add the access modifier private.

You shouldn't change the name of the field. It was color and you changed it to mColor.

Also, the challenge didn't ask for a getter but it might still pass with it in there.

Where do u change it at couse i can not find out how

Hi Aiden,

Check the code posted in the question. It shows where the private modifier goes.

Thanks that helped

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

public String mColor("red") { return mColor; } }

i need help ;0