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
Sophie Tarpey
1,066 PointsError making a new PezDispenser in java
I am using the java objects tutorial and have been having a problem when I try to enter PezDispenser pd = new PezDispenser("Yoda"); in the repl. This is the error that is coming up: java.util.NoSuchElementException
This is the link to my workspace: https://w.trhou.se/p05dy8o2xx
If someone could help that would be greatly appreciated!
Sophie Tarpey
1,066 PointsYes I loaded it first
Derek Markman
16,291 PointsThen maybe try and close and reload your workspace.
Jeremy Hill
29,567 PointsDid you save and compile the PezDispenser class? (javac PezDispenser.java)
1 Answer
Craig Dennis
Treehouse TeacherHi Sophie Tarpey !
I forked your workspace, and compiled PezDispenser.java. It looks like you are missing a semi-colon in your constructor, so it can't load in the REPL at the moment.
Hope that helps!
Derek Markman
16,291 PointsDerek Markman
16,291 PointsI have heard of similar problems in workspaces from other people. Did you remember to :load your java classes to java repl?