Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Aditya Puri1,080 Points
An error in his code which ain't showing up..
SO I found this probable error in his code which is not showing up..
He used the method "isEmpty" in the method "dispense" before he declared it.
Shouldn't this give an error as java reads the code from the top to bottom? WHy isn't an error showing up?
Matt Sorrell6,501 Points
Not sure if you still need help clarifying this, but here goes. I don't think it matters the order the methods are created in because when you create a new instance of the object in the main method it will gain access to all of them.
Zachary Martin3,545 Points
I think I know what you're referring too, he created the method in the The PezDispenser class so he didn't have to declare it in the Example java file.