21.4.10 Creating Your Own Packages

As you know, the Java API types (classes, interfaces and enums) are organized in packages that group related types. Packages facilitate software reuse by enabling programs to import existing classes, rather than copying them into the folders of each program that uses them. Programmers use packages to organize program components, especially in large programs. For example, you might have one package containing the types that make up your program’s graphical user interface, another for the types that manage your application’s data and another for the types that communicate with servers over a network. In addition, packages help you specify unique names for every type you declare, which (as we’ll discuss) helps ...

Get Java™ How To Program (Early Objects), Tenth 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.