The JavaTM Tutorial

| Start of Tutorial | Search Feedback Form

## Trail: Essential Java Classes

> This trail discusses classes from the Java platform that are essential to most programmers. It focuses on classes in the `java.lang` and `java.io` packages, including these:
> - `Thread` and its related classes
> - `Throwable` and `Exception`, and their friends
> - The `Reader`, `Writer`, `InputStream`, and `OutputStream` classes from `java.io` and their descendants

> Handling Errors Using Exceptions explains how you can use Java's exception mechanism to handle errors in your programs. This lesson describes what an exception is, how to throw and catch exceptions, what to do with an exception once you've caught it, and how to best use the exception class hierarchy provided by the Java platform.

> Threads: Doing Two or More Tasks at Once discusses in detail the use of threads that enable your Java applications or applets to perform multiple tasks simultaneously. This lesson describes when and why you might want to use threads, how to create and manage threads and thread groups in your Java program, and how to avoid common pitfalls such as deadlock, starvation, and race conditions.

> I/O: Reading and Writing (but No 'rithmetic) describes the process of getting information into your program and sending it out again through the use of the stream classes in `java.io`. Reading and writing information provides the basis for all kinds of interesting behaviors, such as serializing objects, communicating over a network, or just accessing the file system.

> Setting Program Attributes describes how you can set attributes for your Java programs through the use of properties and command-line arguments. Use properties to change attributes for every invocation of your program; use command-line arguments to change attributes for only the current invocation of your program.

> Accessing System Resources shows you how, through the `System` class, your Java programs can manage properties, set up a security manager, and access system resources such as the standard input and output streams. The `System` class provides a system-independent programming interface to system resources, thus allowing your programs to use them without compromising portability. This lesson also contains a brief discussion of the `Runtime` class and why most programmers should avoid using it.

| Start of Tutorial | Search Feedback Form

Copyright 1995-2001 Sun Microsystems, Inc. All rights reserved.