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 trialDaniel Hernandez-Zuleta
1,478 PointsI don't know how to fix this.
./PezDispenser.java:3: error: <identifier> expected
System.out.printf("The dispenser character is %s", dispenser.mCharacterName);
^
./PezDispenser.java:3: error: illegal start of type
System.out.printf("The dispenser character is %s", dispenser.mCharacterName);
^
./PezDispenser.java:3: error: <identifier> expected
System.out.printf("The dispenser character is %s", dispenser.mCharacterName);
^
./PezDispenser.java:3: error: package dispenser does not exist
System.out.printf("The dispenser character is %s", dispenser.mCharacterName);
^
./PezDispenser.java:3: error: cannot find symbol
System.out.printf("The dispenser character is %s", dispenser.mCharacterName);
^
symbol: class out
location: class System
5 errors
Lucas Smith
11,616 PointsIf I read your code snippet correctly, you have
System.out.printf("The dispenser character is %s", dispenser.mCharacterName);
in the PezDispenser.java file. If that's the case, then that is your problem. The dispenser object doesn't exist in that file, so it is getting an error when it is trying to access it. That line will need to be moved over into Example.java for everything to run smoothly.
Hope this helps!
1 Answer
Daniel Hernandez-Zuleta
1,478 PointsThank you.
Daniel Hernandez-Zuleta
1,478 PointsDaniel Hernandez-Zuleta
1,478 Points(This is in PezDispenser.java) public class PezDispenser{ public String mCharacterName = "Yoda"; System.out.printf("The dispenser character is %s", dispenser.mCharacterName); }
(This is in Example.java)
public class Example {
} }