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

Cannot find symbol error - PezDispenser

I am getting the following error message in my PezDispenser class but I can't see what is wrong - ./PezDispenser.java:12: error: cannot find symbol
pezCount = MAX_PEZ;
^
symbol: variable MAX_PEZ
location: class PezDispenser
1 error

Here's the snapshot of my code - https://w.trhou.se/hwn50qlih8

1 Answer

Hi there,

You've called your constant MAX_PEX at the top, but then tried using MAX_PEZ.

Steve.

Hi Steve,

Thank you! I looked over it for ages, not sure how I didn't spot that!

Cheers,

Andrew

We all do it! Staring at obvious errors and not seeing them is pretty standard, for me! :+1: :smile: