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 Data Structures Getting There Packages

"com" and "teamtreehouse" folders are packages?

So, in this video we created two folders: one called "com", and the other called "teamtreehouse" (which this latter one contained the Treet.java file).

Are the "com" and "teamtreehouse" folders actually considered "packages"? And ultimately, are all folders that contain .java files technically "packages" going forward?

1 Answer

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Indeed they are! The compiler will use the folder structure to try to find the class you are referring to. Packages, like folders provide you the ability to have the same named files in different categorized places.

So there are other ways to include packages, as you'll notice the stuff we are importing aren't there in your directory. You can package up folders and include them like a zip file, but it's called JAR file (Java ARchive). But those folders in the "zip" file are also the package levels.

That make sense?