O'Reilly logo

Special Edition Using Java 2 Standard Edition by Geoff Friesen, Chuck Cavaness, Brian Keeton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Packages

When you start creating a large number of classes for a program, having a way to organize them becomes important. A clutter of class files is not unlike how your hard drive would look without subdirectories or folders. Imagine if all the files on your hard drive were placed in a single folder. You would have thousands of files without any obvious associations among them and you would have to make sure that no two files had the same name.

Class files without any organization cause similar problems. To overcome this, Java has a system called packages. A package contains a group of classes just as a subdirectory contains a group of files. You have already seen how a number of packages are used in the Java API. For example, java.awt and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required