Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Isam Al-Abbasi
2,058 PointsWhy am I getting this error please?
I'm trying to test out the isEmpty method in the repl by creating new dispenser but I keep getting this error:
java> :load PezDispenser.java loaded source file from PezDispenser.java java> PezDispenser pd = new PezDispenser("Yoda"); java.util.NoSuchElementException java>

Isam Al-Abbasi
2,058 PointsThank you stephen, I don't know why I was getting this error but I played around a little with the code and it worked!!

Tristan Smith
3,171 PointsHi Isam,
Congrats on getting it to work! That kind of "push-through" attitude is great. For the benefit of anyone else having this issue, would you mind sharing what your solution was? :-) (Maybe post some before and after code)

Isam Al-Abbasi
2,058 PointsHello Tristan, unfortunately I don't have the code before and after but all I did is correcting some syntax errors on my code and then it worked!
Stephen Shine
5,991 PointsStephen Shine
5,991 PointsCould you put the code in PezDispenser.java in here so we can have a look?
I'm still learning Java too, but after a quick Google I found the Java doc for this exception: https://docs.oracle.com/javase/7/docs/api/java/util/NoSuchElementException.html
Something to do with Enumeration(?)