A Java Package is a collection of Java files that belong together.
Those Java files all start with a line that specifies the package:
package fully.qualified.name.of.the.package;
The above line specifies a package named package, which is nested in another package named the, and so on, with the outermost package's name being fully.
Packages form a hierarchy that mirrors the hierarchy of the file system - all Java files belonging to a package are stored in the same folder, whose name matches that of the package, and subfolders of that folder may contain Java files of a sub-package.
Conversely, the parent folders of the package folder must match the name of any enclosing packages, and so on.
Package names are always written in lowercase, so they do not get confused with class names (which should always start with an upperclase letter).
Most of the classes in Java's standard library are stored within an outmost package named java.
For example, the Arrays class that contains methods to compare arrays for equality is contained in the package java.util.
The fully qualified name of the package is java.util, and the fully qualified name of the class is java.util.Arrays.
If you plan on creating libraries for wide-spread use, the convention is to use package names that start with the inverted top-level domain of your organization (or yourself).
For example, any packages published by Google are sub-packages of the com.google package, and any packages that I would publish through ANU would start with au.edu.anu.comp.
In general, packages prevent naming conflicts (consider how many different people have written classes named Person) - class names only need to be unique within a package.
The fully qualified names can always be used to distinguish multiple classes with the same name.
Files without a package declaration are in what is called the default package.
Code in those files can access definitions in Java files in the same folder, and within explicit packages.
However, no code in an explicit package can access code in the default package - that package is really only for small scale and ad-hoc code.
When a class is within a package, you need to use the fully qualified name of the class to run a main method in it.
For example, if you have a class Foo with a main method in the package bar.zorp, you need to call java as follows:
java bar.zorp.Foo
You also need to do this from the folder that contains the bar folder.