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 Harnessing the Power of Objects Incrementing and Decrementing

Does it matter which order we put the methods?

At 4:54 in the video, we are beginning to start inserting the dispense() method. Normally, I place any new code exactly where Craig is placing new code. We put in the isEmpty() method immediately following the fill() method, and now we are putting this new dispense() method code right in the middle of those two.

Does it really matter where it is placed at, or can I just place it following the isEmpty() method?

1 Answer

andren
andren
28,558 Points

No it does not matter at all where in the class the method declaration is placed. When you actually call a method Java will go through the entire class looking for it either way, so the placement is irrelevant.