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 trialPierce Mulligan
1,106 PointsConfused about braces.
Will the dispenser be filled every time this program is run regardless? Should you not include
System.out.println("Loading Dispenser..."); dispenser.load();
In the original if(dispenser.isEmpty()) statement?
2 Answers
Luke Glazebrook
13,564 PointsWithout looking at the other code it seems like the dispenser will always be empty when the program is started? I may be wrong though.
Peter Price
4,007 PointsHi Pierce,
The System.out.println("Loading dispenser..."); isn't exactly needed because it is just saying "Loading...", but it is nice for the users who don't know what is happening.
The if statement is asking "Is the dispenser empty?", so when you write dispenser.load(); it loads the PEZ dispenser.
But it would be nice to see your code if you still need help.
I hope this helps you.