Typically, to make objects easier to find and use, and to avoid naming conflicts, programmers bundle groups of related objects into class libraries. In Java, a class library is called a package .
Packages can also contain interface definitions.
Roll Your Own Packages You can easily create your own packages and put any number of class and interface definitions in them. Using the Classes and Interfaces from a Package To use the classes and interfaces defined in one package from within another package, you need to import the package. The classes and interfaces that you import must be declared public. The Java Packages Several packages of reusable classes are shipped as part of the Java development environment. The classes and interfaces contained in the Java packages implement various functions ranging from networking and security to graphical user interface elements.