## 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.

# Still confused on Method Signatures.

Hey everybody!

So, I just landed on the video where Craig talks about Method Signatures and am having some trouble understanding the load() method he creates.

Can anyone explain to me in these blocks of code what exactly is going on?

My confusion stems from the first line of the code where 'load(MAX_PEZ)' is utilized. So if I get this straight utilizing the load method calls upon 'load(MAX_PEZ)' which will in turn load the PEZ dispenser to the default max amount of PEZ being 12?

However, when we go back to the Example.java file when inputting a number into dispenser.load() does the default value change to what the user input is?

I apologize for the long question and your help would be most appreciated! public void load() { load(MAX_PEZ); }

public void load(int pezAmount) { int newAmount = mPezCount + pezAmount; if(newAmount > MAX_PEZ) { throw new IllegalArgumentException("Too many PEZ!!!"); } mPezCount = newAmount; }

Hi Jae,

```//  Reference the second function with the MAX_PEZ constant as the argument, 12.

//  The new amount will be the member variable of the current Pez count
//   plus the number of Pez being passed as an argument.
int newAmount = mPezCount + pezAmount;
//  Check if the number of Pez being added by the argument will be over the MAX_PEZ amount.
if(newAmount > MAX_PEZ) {
throw new IllegalArgumentException("Too many PEZ!!!");
//  If an exception isn't thrown by having too many Pez, then make the member variable
//  equal to the new amount of the old Pez count plus the ones added by this function.
} mPezCount = newAmount;
}
```

Please let me know if you have any other questions about method signatures!

Okay, this makes more sense now! One method is so that when no arguments are passed the PEZ count refills with a full load while the other method takes an argument passed within dispense.load(); and checks to see how many PEZ should be loaded to get MAX_PEZ. If the argument passed goes over 12 then an exception is thrown.

Thank you so much Evan!