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 Privacy and Methods

Kae roe
Kae roe
341 Points

I have craigs code word for word yet I still end up with these three errors. Help?

link to screenshots - http://imgur.com/a/Bmrgu

Thanks in advance!

5 Answers

Mohammed Khalil Ait Brahim
Mohammed Khalil Ait Brahim
9,539 Points

I think you named the class PezD instead of PesDispenser

Mohammed Khalil Ait Brahim
Mohammed Khalil Ait Brahim
9,539 Points

I can see that you wrote printLn instead of println (all lowercase)

Kae roe
Kae roe
341 Points

Thank you! That eliminated 1 error still confused about the other 2

Charlene Allfrey
Charlene Allfrey
5,865 Points

You can't call a class from another file unless the file name is the same as the class name. So your code is trying to call the PezDispenser class like in the example but you named your class file PezD.java. You either have to update your code to match the new file/class name or you need to correct the files and recompile to get it to work. Hope that makes sense :-)

i had almost the exact code problem, and thought that I had Craigs code word for word. As usual when I think I have it word for word its usually a very small typo. Thanks for reminding me to check my spelling.

From the image you provided I can see two errors .one is as poited out printLn -> should be println the other one is the name for the class PezDispenser .he is using PezDispenser because the class he created in side PezDispenser.java is named PezDispenser. and one thing you should know is that if the class name is PezDispenser the file name should also be PezDispenser.java. from the pic I can see that yours is different .therefore you either have to change the name for the class or change the declaration appropriately .