Packages

Packages are Java's way of grouping classes together in a way that can be easily imported for use or scoped to avoid name conflicts. Essentially, packages are a collection of classes that all reside in the same place.

The Java API discussed above is a collection of packages that implement standard and native classes. In order to have access to use classes in a package in your Java code, you use the import keyword. For example, the package we are going to discuss first is the java.awt package (the Java Abstract Windowing Toolkit package). In order to use AWT classes (such as Windows) in your code, you would include:

import java.awt.*;
in your code. This will make all classes in the java.awt package accessible.

More info on using packages is available at http://java.sun.com/tutorial/tools/environment/packages.html