Hello Jose,
1. Why packages:
Because you and I may both create a class with the same name. For example, Element or Document. Packages give us, and the people who use our classes, a way to distinguish between the classes.
When you specify a class using the package name AND the class name, you are said to be using the "fully qualified" class name. As Anthony mentioned, "java.util.Date" is one way to specify the fully qualified name of that particular class, and that is a different class from "java.sql.Date" even though the class names are both "Date".
2. You probably already know how to use classes that are in packages. For example, the Vector class is in the package java.util and you can specify a Vector two ways:
a: put an import statement at the top of the file:
import java.util.Vector;
...
Vector v = new Vector();
b: specify the fully qualified name:
java.util.Vector v = new java.util.Vector();
3. What if you are defining your own class and you want to put it in a package? Then you need to do two things:
a: put the package statement as the first line of your code (only comments or blank lines can come before a package statement)
b: create a folder structure that mirrors the package statement
For example, if your package is com.josenavarro.coolapp and your class is named MyApp then you would have this folder structure:
com (folder)
josenavarro (folder inside com)
coolapp (folder inside josenavarro)
MyApp.class (compiled java class inside coolapp folder)
If you are using an IDE then it might create the folder structure for you, but if you are using the Java SDK then you need to compile the class and then create the folder structure and put the class in the appropriate place.
4. Once you have created the folder structure you can use the jar utility to create a jar file. This is optional but makes sense if you have lots of classes in your folder structure.
5. You probably noticed that a lot of package names look like www addresses, but backwards. The reason for this is that companies (and people) who create classes want to ensure that their package name is unique (so their classes don't potentially conflict with someone else's) and one way to get a unique package name is to take your registered domain and use it as the start of all your package names.
So if your company domain is mycompany.com and you have some customer projects and some internal projects, you might consider package names such as:
com.mycompany.cust.customera.project1
com.mycompany.internal.database.dbproject
etc.
Tony