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!
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

Hector. Calderon
621 PointsExample.java:7: error: cannot find symbol
In the previous question the error is pointing to the period or extension.
Example.java:7: error: cannot find symbol
System.out.printf("The dispenser character is %s\n", dispenser.getCharacterName());
symbol: method getCharacterName()
location: variable dispenser of type PezDispenser
4 Answers

Jeremy Hill
29,567 PointsOk it looks like you will need to create a get method in dispenser class- I didn't see one.

Hector. Calderon
621 PointsHello Jeremy Thanks for replying fast, here is the code:
public class Example {
public static void main(String[] args) {
// Your amazing code goes here...
System.out.println("We are a making a new Pez Dispenser");
PezDispenser dispenser = new PezDispenser();
System.out.printf("The dispenser character is %s\n", dispenser.getCharacterName());
}
}

Hector. Calderon
621 PointsJeremy, and here is the rest:
public class PezDispenser { private String mCharacterName = "Yoda"; }

Hector. Calderon
621 PointsThank you Jeremy! it work. I guess I miss that part in the video because I was typing the code and trying to go faster than Craig. Thanks once again.

Jeremy Hill
29,567 PointsCool, you're welcome :)
Jeremy Hill
29,567 PointsJeremy Hill
29,567 Pointscan you post all of the code?