CHAPTER 15

MISCELLANEOUS TOPICS

15.1 Packages

15.1.1 Defining and using packages

When one has too many files, one needs to organize them in folders (directories). Similarly, when one has too many classes (developed by him) to use, some organization or grouping is needed. Java offers it in the form of package. We know that Java gives us many useful classes to use directly in our programs. These classes are also grouped into packages. The few common packages are applet, awt, color, event, io, lang, math and swing. The complete list of JDK application programming interface (API) packages is presented in the appendix.

A package can be defined as “a collection of related classes and interfaces that provides access protection and ‘namespace management’”. ...

Get Programming with Java 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.