6.7 Packages

From mine own library with volumes that i prize above my dukedom.

—WILLIAM SHAKESPEARE, The Tempest

A package is a named collection of related classes that can serve as a library of classes for use in any program. With packages, you do not need to place all those classes in the same directory as your program. Although this is an important and useful topic, the rest of the material in this book does not use the discussion of packages presented here. Therefore, you may cover this section at any time during your reading of this book.

To understand this material, you need to know about folders, or directories; path names for folders; and how your operating system uses a path (environment) variable. If you do not know about these things, ...

Get Java: An Introduction to Problem Solving and Programming, 8th 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.