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) Harnessing the Power of Objects Methods and Constants

this is so difficult

what is a private uninitialized field?

GoKart.java
public class GoKart {
  private String mColor;
  public static final int MAX_BARS = 8;
  private mBarsCount;
    mBarsCount = 0;
  public GoKart(String color) {
    mColor = color;
  }

  public String getColor() {
    return mColor;
  } 
}

1 Answer

Christopher Augg
Christopher Augg
21,223 Points

Emily,

You got this! The private uninitialized field is a private member variable that has not been initialized. You have :

         private mBarsCount; //What is missing? Variable need a type. What type would a count require?

Also, the instructions say, "Now let's add a private uninitialized field to store the current number of energy bars. Name it mBarsCount. Initialize it to zero in the constructor."

Did you initialize it in the constructor?

I hope these hints can get you on track. Let me know if you need any further assistance though. I am glad to help.

Regards,

Chris

thank you! computers are just one of my biggest weaknesses!

Christopher Augg
Christopher Augg
21,223 Points

No problem. You are not alone. Many people have a hard time learning abstract ideas in computer languages etc. Remember, when something is easy, you are not learning. It is easy because you already know it. The key is sticking with it to the end and not being afraid to ask for help. Eventually it will become easy and you will realize that you learned it well.

Don't give up!

Regards,

Chris