Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Objects (Retired) Harnessing the Power of Objects Helper Methods and Conditionals

Confused 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

Without looking at the other code it seems like the dispenser will always be empty when the program is started? I may be wrong though.

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