Chapter 18. Packages

 

For some reason a glaze passes over people's faces when you say “Canada”. Maybe we should invade South Dakota or something.

 
 --Sandra Gotlieb, wife of Canadian ambassador to U.S. (1981–1989)

Packages define units of software that can be distributed independently and combined with other packages to form applications. Packages have members that are related classes, interfaces, and subpackages, and may contain additional resource files (such as images) used by the classes in the package. Packages are useful for several reasons:

  • Packages create groupings for related interfaces and classes. For example, a set of library classes for performing statistical analysis could be grouped together in a stats package. The package can be placed ...

Get THE Java™ Programming Language, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.