Creating Our Own Packages
The first step is to decide what the name of our package is going to be.
The name we choose for our package depends on how we are going to be using those classes.
Step two in creating packages is to create a directory structure on our disk that matches the package name.
If your package has just one name (mypackage), we’ll only have to create a directory for that one name.
If the package name has several parts, however, we’ll have to create directories within directories.
For the package name edu.nonsense.eng.fooblitzky, we’ll need to create an edu directory and then create a nonsense directory inside edu, an eng directory inside nonsense, and a fooblitzky directory inside eng. Our classes and source files can then go inside the fooblitzky directory.
Use package to Add Our Class to a Package
The final step to putting our class inside packages is to add the package command to our source files.
The package command says “this class goes inside this package,” and is used like this: