Package categories in Java
Package categories in Java
Java supports two types of packages as shown below in the hierarchy structure:
Build-In Packages in Core Java:
Java packages can be categorized in the hierarchy structure shown as:
Packages in the Java language begin with "java"
or "javax" as
we can found in both hierarchy
structure shown above. Note that, the package "java" also has
subpackages in which the package "awt" is further has a
subpackage called "event" that is imported to access classes
and interfaces to handle the events fired on the awt-component in a program.
Thus the the expression to import the package is shown as"
import awt.event.*;
Lets understand these java packages shown in the table, from which you can access interfaces and classes.
Package Name | Description |
java.lang | It contains
essential classes that represent primitive data types (such as int
& char) as well as more complex classes, including numerics, strings, objects, compiler, runtime, security, and threads. This is the only package that is automatically imported into every Java program. |
java.io | This package
provides classes to manage input and output streams to read data
from and write data to files, strings, and other sources. |
java.util | It contains
miscellaneous utility classes, including generic data structures,
bit sets, time, date, string manipulation, random number generation, system properties, notification, and enumeration of data structures. |
java.awt | It provides an
integrated set of classes to manage user interface components such
as windows, dialog boxes, buttons, checkboxes, lists, menus, scrollbars, and text fields. |
java.net | It provides classes
for network support, including URLs, TCP sockets, UDP sockets, IP addresses, and a binary-to-text converter. |
java.applet | It enables the
programmer to create applets through the Applet class. It
also provides several interfaces that connect an applet to its document and to resources for playing audio. |
java.nio | This package handles New I/O
framework for Java |
java.math | This package includes various mathematical operations. |
java.security | It is used for key generation,
encryption and decryption |
javax.swing | It is used for hierarchy of packages for platform-independent rich GUI components. |
java.sql | It provides classes to support connectivity from JDBC to access databases |