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 trialLawrence McBride
39 PointsWhat is wrong with my code?
From what I can see my code matched what Craig has on the screen in the video however, I keep getting this error message: location: Class Example Example.java:6: error: cannot find symbol PezDispenser dispenser = new PezDispenser ();
With an arrow under the "P" in new PezDispenser
6 Answers
ISAIAH S
1,409 PointsIn the toolbar on the right, right click on Pez Dispenser.java
, press rename, and erase the space.
Lawrence McBride
39 PointsOh, in the actual name of the file! Thanks for your help!
ISAIAH S
1,409 PointsAlways happy to help!
Viktor Johansson
3,523 PointsI could take a look if you post the whole code.
Lawrence McBride
39 PointsSystem.out.println("We are making a new Pez Dispenser."); PezDispenser dispenser = new PezDispenser(); System.out.Printf("The dispenser character is %s\n", dispenser.mCharacterName);
ISAIAH S
1,409 PointsTry erasing the space in PezDispenser ();
.
Lawrence McBride
39 PointsI've tried it with and without a space in there, it comes back with the same error message unfortunately.
ISAIAH S
1,409 PointsCan I see your workspace? Just click the picture of a camera in the upper right corner and press Take Snapshot . Then, press the photo you made, copy the link, and paste it here.
Lawrence McBride
39 PointsHere you go. https://w.trhou.se/04n8hopivu
ISAIAH S
1,409 PointsErase the space in between Pez and Dispenser, and by the way what you did was called a Snapshot.
Lawrence McBride
39 PointsUnfortunately at the moment the the only place there is a space in between Pez and Dispenser is in the System.out.println.
Victor Learned
6,976 PointsVictor Learned
6,976 PointsPlease post your code otherwise we won't be able to help.