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

Luis Ignacio Gomez
Luis Ignacio Gomez
567 Points

Java cannot find symbol

Hi! I have a problem coding in java: Where is the part where says "pezCount", java cannot find the symbol "p" at the beggining of the word. Here is my code:

class PezDispenser {
  public static final int MAX_PEZ = 12;
  final String characterName;
  private int pezCoun;

  public PezDispenser (String characterName) {
    this.characterName = characterName;
    pezCount = 0;
  }

  public void fill() {
    pezCount = MAX_PEZ;
  }

  public  String getCharacterName() {
    return characterName;
  }

  }

Moderator edited: Markdown added so that code renders properly in the forums.

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You have a typo in the beginning which is throwing everything a bit off.

You typed:

  private int pezCoun;

But you meant to type:

  private int pezCount;  // note the "t" on the end

So later in your code, when you try and access pezCount, it doesn't know what you mean because there is no pezCount declared... only a pezCoun.

Hope this helps! :sparkles: