|Objects, Classes, and Interfaces|
Eight packages comprise the standard Java development environment.
The Java Language PackageThe Java language package, also known as
java.lang, contains classes that are core to the Java language. The classes in this package are grouped as follows:
The compiler automatically imports this package for you. No other packages are automatically imported.
- The granddaddy of all classes--the class from which all others inherit. This class was covered previously in this lesson in The
- Data Type Wrappers
- A collection of classes used to wrap variables of a primitive data type:
- Two classes that implement character data. The String and StringBuffer Classes is a thorough lesson on the use of both types of strings.
- These two classes provide let your programs use system resources.
Systemprovides a system-independent programming interface to system resources and
Runtimegives you direct system-specific access to the runtime environment. Using System Resources describes both the
Runtimeclasses and their methods.
ThreadGroupclasses implement the multi-threading capabilities so important to the Java language. The java.lang package also defines the
Runnablemakes it convenient for Java class to be active without subclassing the
Threadclass. Through an example-oriented approach Threads of Control will teach you about Java threads.
Classclass provides a runtime description of a class and the
ClassLoaderclass allows you to load classes into your program during runtime.
Mathclass provides a library of math routines and values such as pi.
- When an error occurs in a Java program, the program throws an object which indicates what the problem was and the state of the interpreter when the error occurred. Only objects that derive from the
Throwableclass can be thrown. There are two main subclasses of
Error. Exceptions are a form of
Throwablethat "normal" programs may try to catch. Errors are used for more catastophic errors--normal programs should not catch errors. The
java.langpackage contains the
Errorclasses, and numerous subclasses of
Errorthat represent specific problems. Handling Error Using Exceptions shows you how to use exceptions in your Java programs to handle errors.
Processobjects represent the system process that is created when you use
Runtimeto execute system commands. The
java.langpackages defines and implements the generic
The Java I/O PackageThe Java I/O Package (
java.io) provides a set of input and output streams used to read and write data to files or other input and output sources. The classes and interfaces defined in
java.ioare covered fully in Input and Output Streams.
The Java Utility PackageThis Java package,
java.util, contains a collection of utility classes. Among them are several generic data structures (
Hashtable) a useful object for tokenizing a string and another for manipulating calendar dates. The
java.utilpackage also contains the
Observableclass, which allow objects to notify one another when they change. The
java.utilclasses aren't covered separately in this tutorial although some examples use these classes.
The Java Networking PackageThe
java.netpackage contains classes and interface definitions that implement various networking capabilities. The classes in this package include a class that implement a URL, a connection to a URL, a socket connection, and a datagram packet. You can use these classes to implement client-server applications and other networking communication applications. Custom Networking and Security has several examples using these classes, including a client-server example and an example that uses datagrams.
The Applet PackageThis package contains the
Appletclass -- the class that you must subclass if you're writing an applet. Included in this package is the
AudioClipinterface which provides a very high level abstraction of audio. Writing Applets explains the ins and outs of developing your own applets.
The Abstract Window Toolkit PackagesThree packages comprise the Abstract Window Toolkit:
Creating a User Interface covers all three of the AWT packages.
- AWT Package
java.awtpackage provides graphical user interface (GUI) elements that are used to get input from and display information to the user. These elements include windows, buttons, scrollbars, and text items.
- AWT Image Package
java.awt.imagepackage contains classes and interfaces for managing image data, such as setting the color model, cropping, color filtering, setting pixel values, and grabbing snapshots of the screen.
- AWT Peer Package
java.awt.peerpackage contains classes and interfaces that connect platform-independent AWT components to their platform-dependent implementation (such as Motif widgets or Microsoft Windows controls).
Objects, Classes, and Interfaces