Packages

There are several keywords that control the visibility of a class or the members of a class. Access Modifiers on page 103 summarizes these modifiers (private, no keyword, protected, and public). Some of these access modifiers apply to packages, so we'll start with the “how and why” of Java packages.

What a package is

When you're just writing a few programs for your personal use, you can put the classes in any old directory and use any old names. When you have a team of twenty programmers working on five different software products that interact, you need a better way to organize your files than “putting them in any old directory.”

Java uses the term package to mean a collection of related classes that form a library, and which ...

Get Just Java™ 2 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.