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

Java Java Objects (Retired) Meet Objects Creating Classes

New class error.

So I set this one as public class PezDispenser { public String mCharacterName = "Yoda"; }

then

System.out.println("What are making a new Pez Despenser"); PezDispenser dispenser = new PezDispenser(); System.out.printf("The dispenser character is %s\n", dispenser.mCharacterName);

Why is it getting me in error on this like - PezDispenser dispenser = new PezDispenser()?

Gives me this error "Example.java:6: error: cannot find symbol
PezDispenser dispenser = new PezDispenser();
^
symbol: class PezDispenser
location: class Example
Example.java:6: error: cannot find symbol
PezDispenser dispenser = new PezDispenser();
^
symbol: class PezDispenser
location: class Example
2 errors "

1 Answer

Never mind found my problem, the new file was misspelled. Sorry!