This trail discusses classes from the Java platform that are essential to most programmers. In particular, it focuses on classes from the
java.iopackages, including these:
Like the rest of the tutorial, this trail is designed so that you can skip around. Feel free to read only the lessons for the classes that interest you.
Threadand its related classes
Exception, and their friends
java.ioand their descendants
StringBufferillustrates how to manipulate character data using the
StringBufferclasses. It also teaches you about accessor methods and how the compiler uses
StringBuffers behind the scenes.
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
Systemclass, your Java programs can manage properties, set up a security manager, and access system resources such as the standard input and output streams. The
Systemclass 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
Runtimeclass and why most programmers should avoid using it.
Handling Errors with 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.
Doing Two or More Tasks at Once: Threads 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.
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, invoking methods on objects in another VM, communicating over a network, or just accessing the file system.