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 trialMartin Turner
1,757 PointsERROR: Cannot find symbol (MAX_PEZ)
Hi all,
I'm using the java-repl to follows the steps on the Methods and Constants video; as far as I can see, my code is identical; however, after created the new PezDispenser object as name pd, when I input pd.MAX_PEZ I get the following error message:
ERROR: cannot find symbol
symbol: variable MAX_PEZ
location: variable pd of type PezDispenser
pd.MAX_PEZ;;
Here's my code from the PezDispenser class:
public class PezDispenser {
public final int MAX_PEX = 12;
private String mCharacterName;
public PezDispenser(String characterName) {
mCharacterName = characterName;
}
public String getCharacterName() {
return mCharacterName;
}
}
Many thanks!
2 Answers
Steve Hunter
57,712 PointsCould it be the difference between MAX_PEX
in your code and MAX_PEZ
in your repl?
Steve.
Martin Turner
1,757 PointsHi Steve,
Thanks yes I did spot that after, though even with it amended I seem to have the same issue
Martin Turner
1,757 PointsActually I reloaded the repo and seems ok now, thanks for your comment!
Martin Turner
1,757 Pointsrepl even, clearly spelling isn't my strong point today!! :D
Steve Hunter
57,712 PointsGlad you got it going again!
Steve.
Martin Turner
1,757 PointsMartin Turner
1,757 PointsSorry I did notice the obvious MAX_PEX spelling mistake! Though even with this corrected, I am still facing the same error message. Thanks