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

jinhwa yoo
jinhwa yoo
10,042 Points

what's wrong?

Having trouble with this, not sure were to start from?

Vrezh Gulyan
Vrezh Gulyan
11,161 Points

You have to be way more specific then to ask whats wrong? What have you done so far. What part is confusing to you?

jinhwa yoo
jinhwa yoo
10,042 Points

Place the BlogPost.java file in the proper package by using the package keyword.

Let's create some code for the Example company. They own the domain example.com. Place the BlogPost.java file in the proper package by using the package keyword.

Having trouble with this, not sure were to start from?

1 Answer

Vrezh Gulyan
Vrezh Gulyan
11,161 Points

Thanks for the clarification, so basically packages are a way to group classes or other bits of code in a project. You do this for multiple reasons but to name a few this is incase you have classes with the same name they will be differentiated by the package they are in and you saw another example in the coding challenge which has you import a package into the Display.java code in the fourth part of the exercise. You can then safely reference the classes within that package. To get you started all the first part of the challenge is , is to just indicate that the class BlogPost.java is part of a certain package. This package in this case is a domain called example.com. It is a common for that domain to be flipped so the first part is :

package com.example;