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 trialArturo Galan
558 PointsWhy can't I create a new dispenser in the java-repl?
When I try to create a new dispenser in the java-repl using the command
PezDispenser pd = new PezDispenser("Yoda");
it gives me an error and the error looks like this
ERROR: cannot find symbol
symbol: class PezDispenser
location: interface Evaluation
PezDispenser method$y1r0so3qbxfcwlg4hz6p();
^
I'm not sure what this means and I've tried searching the internet with no luck. Maybe I have a syntax error somewhere, but I've scrutinized my code for a pretty long time. Please help!!!
2 Answers
Kourosh Raeen
23,733 PointsDid you load the java file in repl?
:load PezDispenser.java
Arturo Galan
558 PointsYea but it's still giving me the error
Craig Dennis
Treehouse TeacherTry to compile it outside the REPL
javac PezDispenser.java
Do you get any syntax errors?
Soumyadeep Mukhopadhyay
1,772 PointsActually the problem was with repl. The Treehouse staff Chris Ramacciotti said that in repl the :load command is unable to parse correctly if in the comments there is something called class i. e., //............ class........ then it won't compile. If you run the same code removing all comments the program will run.
Soumyadeep Mukhopadhyay
1,772 PointsThere are no syntax errors when compiled as. javac PezDispenser.java
Soumyadeep Mukhopadhyay
1,772 PointsSoumyadeep Mukhopadhyay
1,772 PointsThank you for posting this question I am facing the same problem. This is not just the case with this example but with the previous one too, "PezDispenser.MAX_PEZ;" even this code shows the same error.
THANKS FOR POSTING THIS QUESTION!! AND THANKS IN ADVANCE TO WHOEVER ANSWERS THIS!!