A java package is a group of similar types of classes, interfaces, and sub-packages providing access protection and namespace management. Package in java can be categorized in two forms, built-in package, and user-defined package.
Advantage of Java Package
- Java package is used to categorize the classes and interfaces so that they can be easily maintained.
- Java package provides access protection.
- Java package removes naming collision.
Some of the existing packages in Java are −
- java.lang − bundles the fundamental classes.
- java.io − classes for input , output functions are bundled in this package.
- java.util - classes such us vectors, hash tables, random numbers, date.
- java.awt - classes for windows, buttons, lists, menus etc.
- java. net - classes for networking.
- java.applet - classes for creating and implementing applets.