package declarations

index
INTERMEDIATE

A package is a single folder (directory) containing a group of related classes and interfaces.

A package declaration, if used, must be the first thing in the file, and describes the folder in which it occurs. For example, the declaration

package org.xml.sax;

specifies that the class is to be found in the directory org/xml/sax.

The import declaration can be used to make an entire package, or individual classes within a package, more easily accessible to your Java program.

If no package declaration is specified in a file, the "default package" is used. The default package cannot be imported by other packages.