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 trialAntonio Foresta
931 PointsI'm not sure what the role of this method in this class is
I understood that the role of this is crucial for the whole thing working but I'm not sure why .
public void fill(){ fill(MAX_PEZ); }
2 Answers
cam
7,468 PointsThis is an overload for the other fill(int pezAmount) method. This method takes an integer argument for how many pez to load. But if you call the fill method without a parameter, it is redirected to call the fill method with the MAX_PEZ number as the parameter. If you look at the code for the fill(int pezAmount) method, I think it will make more sense. Hope this helps!
Antonio Foresta
931 Pointsthanks cam all clear !