Java Java Objects Harnessing the Power of Objects Filling the Dispenser

when dispenser.fill is typed what does that do?

when dispenser.fill is typed what does that do?

1 Answer

Aryaman, When dispenser.fill() is typed in example.java, you are calling the function 'fill' in PezDispenser.java. For a function to run in Java, you have to call it. So when you created the new dispenser in example.java, you then called it with the function: dispenser.fill(). Hope that wasn't too confusing. Cheers,

~ Gabriel