Previous | Next | Trail Map | Writing Java Programs | Table of Contents


Writing Java Programs

This trail covers the fundamentals of programming in the Java language including discussions of several of the core classes shipped with the Java environment. Like the rest of the tutorial, the Java trail was designed so that you can skip around. As Java has many similarities with C and C++, if you are an experienced C or C++ programmer, you may want to skim the first few lessons to orient yourself to Java then dive into the later lessons as you are interested in them. Also, feel free to jump to other trails in the tutorial as you see fit. The lessons in other trails will provide links to any lessons in this trail if they contain pre-requisite information.

The book version of this tutorial breaks this trail in two:


Writing Java Programs

Object-Oriented Programming Concepts: A Primer cuts through the hype surrounding object-oriented technology and teaches you its core concepts: objects, messages, classes, and inheritance. It's important to understand these key concepts before delving into the specifics of the Java language. This lesson also contains a bibliography for further reading on the subject. Feel free to skip this lesson if you are already familiar with object-oriented programming.

The Nuts and Bolts of the Java Language introduces you to several components of the Java language by explaining a simple Java application line by line. You will learn about the syntax and semantics of the Java language, plus several features of the Java programming environment.

Objects, Classes, and Interfaces takes the concepts you learned in Object-Oriented Programming Concepts: A Primer and walks you through how to make use of those concepts in the Java language. You will learn how to create, use, and destroy objects, how to write your own classes, including information about writing methods and creating subclasses, and how to create and use interfaces. And finally, this lesson shows you how to manage your classes and interfaces within packages. This lesson is a complete do-it-yourself "Object-Oriented Programming in Java" lesson.

Writing Global Programs describes how to use the new features in the 1.1 release of the JDK to write internationalized and localized programs. Important: This lesson reflects features that are new for the 1.1 release of the JDK. The material presented here won't work for previous releases of the JDK.


Using the Core Java Classes

The String and StringBuffer Classes illustrates how to manipulate character data using the String and StringBuffer classes. Through this lesson you will also learn about accessor methods and how the compiler uses Strings and 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.

Using System Resources shows you how your Java programs can access system resources (such as standard I/O, array copying, and property management) through the System class. The System class provides a system-independent programming interface to system resources, allowing your programs to use them without compromising portability.

Handling Errors using Exceptions explains how you can use Java's exception mechanism to handle errors in your programs. In this lesson you will learn 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 development environment.

Threads of Control discusses in detail the use of threads that enable your Java applications or applets to perform multiple tasks at the same time. This lesson describes when and why you might want to use threads, shows you how to create and manage threads and thread groups in your Java program, and shows you how to avoid common pitfalls such as deadlock and race conditions.

Input and Output Streams begins with a description of your likely first encounter with Java input and output (I/O) streams. Then this lesson provides an overview of the InputStream and OutputStream family of classes. From there, this lesson provides many examples of how you to use the most popular I/O streams, including two examples on how to write your own filtered streams.


Previous | Next | Trail Map | Writing Java Programs | Table of Contents