previous
|
start
|
next
Organizing Related Classes into Packages
Package: Set of related classes
To put classes in a package, you must place a line
package packageName;
as the first instruction in the source file containing the classes
Package name consists of one or more identifiers separated by periods
For example, to put the
Financial
class introduced into a package named
com.horstmann.bigjava
, the
Financial.java
file must start as follows:
package com.horstmann.bigjava;
public class Financial
{
. . .
}
Default package has no name, no
package
statement
previous
|
start
|
next