Professional Documents
Culture Documents
Defining Packages
• Any classes declared within that file will belong to the specified package.
If you omit the package statement, the class names are put into the default
package, which has no name. • general form of the package statement:
package pkg;
Java uses file system directories to store packages. For example, the .class files
for any classes you declare to be part of MyPackage must be stored in a
directory called MyPackage. • The directory name must match the package
name exactly.
package pkg1[.pkg2[.pkg3]];
Examples:
1. java.lang
2. java.util
3. java.io
4. java.awt
5.java.net
## package firstPackage;