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

Created a PezDispenser object but cannot get the MAX_PEZ object

This is my code:

```import java.lang.String;

public class PezDispenser{
    public final int MAX_PEZ = 12;
    private String mCharacterName;

public PezDispenser(String characterName) {
    mCharacterName = characterName;
}

public String getCharacterName() {
    return mCharacterName;
}

}

It successfully creates a PezDispenser object: but I get this error when I try to get the MAX_PEZ object:

ERROR: Cannot find symbol symbol: variable MAX_PEZ location: variable pd of the type PezDispenser pd.MAX_PEZ;; ^

2 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Hmmm are you sure the file is saved?

So I saved the file and recompiled it and now I can't even make a new object:

ERROR: cannot find symbol Symbol: class PezDispenser Location: interface Evaluation PezDispenser method$ylxscimq4gpaw5d0bn26(); ^