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 trial

Java Java Objects Harnessing the Power of Objects Incrementing and Decrementing

omkar chendwankar
omkar chendwankar
1,668 Points

Its basic I should have asked it first,why mr. craig is operating between two folders example.java and pezdispenser.java

and I couldnt understand some point till now, are there more detailled videos

2 Answers

Brendon Butler
Brendon Butler
4,254 Points

They're files, not folders. And you do this for organization reasons. You can have all your classes in one file, but it would get very long and confusing.

Markus Amon
Markus Amon
709 Points

its orgaisation^^ in the real world u dont want 1 big ass code u want many small pieces that puzzle together in a programm :) its easyier to maintain^^ all of the dispenser is defined in PezDispenser.java while Example.java is exposed to the user of the programm

lets say u make a game^^

one file will be stitching together the user can do then u have Inventory.java that sets stuff like MAX_WEIGHT MAX_SLOTS etc. u dont want this to be changed by the user and if u ever gonna tweak the values u dont have to search for it^^