What is a Java Package


A Java package is a collection of related classes that can be imported into your program to support your software. They also provide namespace management, as well as access protection.

Note :A namespace is the scope of the name of a variable.

The following table shows some of the main packages that are included in the recent Java 1.4 SDK (Software Development Kit) release along with a brief description of what they include.

Package Description
java.lang This is the fundamental Java package containing classes essential to the Java language. This package is included in your program by default and contains many useful classes, such as String, Thread, and the primitive data type support classes.
java.io The I/O package contains classes that allow support for input and output operations.
java.awt This is the Abstract Window Toolkit package and contains all the necessary classes to create a GUI within your Java applications and applets.
java.awt.event This package is used to support the Abstract Window Toolkit by containing classes for event handling.
java.awt.image This package provides important classes for storing and manipulating images, most notably the BufferedImage and VolatileImage classes
javax.swing The Swing package, as with the AWT package, is used to create a GUI. However, Swing is the newer of the two and, in our opinion, the best one to use
javax.swing.event As with the java.awt.event package, this includes extra event handling functionality to support the javax.swing package.
java.util The utility package contains many useful classes, including storage classes such as ArrayList and LinkedList.
java.net This package contains everything you need to handle basic networking in Java.
java.nio This is a new package to the 1.4 release and contains classes used to implement NIO (New I/O).
java.sql Finally, we have the SQL package, which gives us database support within Java.

Although there are many other packages within the Java language, the above list is probably the most common that you will come across. Let's now take a look at how we can use and import these standard packages into our Java applications and applets.

Legal Disclaimer

Our website is not responsible for the information contained by this article. Webworldarticles.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.


This article was sent to us by: Gabriela C. Perez at 12242007

Related Articles

1. What are Java Listeners
A listener in Java is an object that is used to handle events. In effect, it is implemented to listen for events and then tell the program the required informati...

2. Java EE Platform
Java is a programming language. The Java EE Platform provides a runtime environment (also known as JRE or Java Runtime Environment) as well as a development kit (also known...

3. Java EE Architecture
The Java EE application program interface (API) consists of a suite of technology components and services that are used to build enterprise applications. It includes compon...

4. ISO Management Elements in Java EE .NET Platforms
In a heterogeneous application and platform environment, IT managers are faced with different and often incompatible management frameworks. IT organizations often partiti...

5. Importing Java Packages
To use a package within a Java application or applet, we need to import it. We do this by means of the import keyword. So, for example, if we wish to include the I/O packag...

6. Character Escape Sequences
Character escape sequences allow for a character to be interpreted differently than its literal value. Character escape sequences are defined using the backslash (\) ch...

7. Conditional Statements
The ability to choose the path that your program takes, based on any given data, is the key to all functionality in programming. In order to create conditional statemen...

8. Java Methods
Methods are used as the building blocks of your program, performing tasks that can be called again and again and using the same code to perform the task each time. The basi...

9. Variable Scope
The scope of a variable is the area in which a variable belongs, specified by the area in which it is declared. The following example code contains two declared variables, ...

10. Regular Expressions in Java
A regular expression is a code that is used to match a pattern in a given string and is new to Java 1.4. Regular expressions are made up of normal characters and metacharac...