Home > Store

Java Tutorial, The: A Short Course on the Basics, 3rd Edition

Register your product to gain access to bonus material or receive a coupon.

Java Tutorial, The: A Short Course on the Basics, 3rd Edition


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2001
  • Edition: 3rd
  • Book
  • ISBN-10: 0-201-70393-9
  • ISBN-13: 978-0-201-70393-1

Praise for The Java™ Tutorial, Second Edition

"This book stands above the rest because it has been available on the web and read by thousands of Java programmers. The authors have received an enormous amount of feedback about which sections are good and which sections are confusing; the confusing ones have been improved. I doubt that any other Java book has undergone such trial by fire...."

-Metroplex Java User Group, www.javamug.org/reviews/

Whether you're taking a class or learning on the job, The Java™ Tutorial, Third Edition, is a hands-on guide that lets you quickly become proficient with the Java programming language. Written by members of the Java Software team at Sun Microsystems, the book uses an interactive approach to help you learn the Java platform by example.

Since its first online release in 1995, the material in The Java™ Tutorial has been updated continuously to reflect reader feedback and new releases of the Java platform. This third edition has been thoroughly updated to cover v1.3 of the Java Platform, Standard Edition, as well as preceding versions as early as JDK 1.1.

You will find clear explanations of such fundamentals as objects, classes, and data structures. In addition, the book provides introductions to object-oriented programming, applet construction, and user interface design. Other topics include exceptions, I/O, and threads. To help beginners avoid many common mistakes, an entire chapter is devoted to programming problems and their solutions. Convenient summaries at the end of each section are new to this edition. Also new for this edition are "Questions and Exercises" sections to help you practice what you learn. The accompanying CD-ROM is filled with valuable resources, including:
  • All three Java™ Tutorial books in HTML: The Java™ Tutorial, The Java™ Tutorial Continued, and The JFC Swing Tutorial.
  • All major versions of the Java platform, versions 1.0.2 through 1.3 for the Solaris and Win32 platforms. The latest Java platform for Linux, Standard Edition v1.3, is also included.
  • API documentation for the Java platform.
  • Source code for all examples.

After working through the lessons in this proven tutorial, you will be well prepared to use the Java programming language in your school or workplace.


Sample Content

Online Sample Chapter

On the Road to Understanding Java

Downloadable Sample Chapter

Click below for Sample Chapter related to this title:

Table of Contents


1. Getting Started.

About the Java Technology.

How Will Java Technology Change My Life?

First Steps (Win32).

A Checklist.

Creating Your First Application.

Creating Your First Applet.

Error Explanations (Win32).

First Steps (UNIX/Linux).

A Checklist.

Creating Your First Application.

Creating Your First Applet.

Error Explanations (UNIX/Linux).

First Steps (MacOS).

A Checklist.

Creating Your First Application.

Creating Your First Applet.

Error Explanation (MacOS).

A Closer Look at HelloWorld.

Explanation of an Application.

The Anatomy of an Applet.

Code Samples.

2. Object-Oriented Programming Concepts.

What Is an Object?

What Is a Message?

What Is a Class?

What Is Inheritance?

What Is an Interface?

How Do These Concepts Translate into Code?


Code Samples.

3. Language Basics.



Expressions, Statements, and Blocks.

Control Flow Statements.

Code Samples.

4. Object Basics and Simple Data Objects.

The Life Cycle of an Object.

Characters and Strings.



Code Samples.

5. Classes and Inheritance.

Creating Classes.

Managing Inheritance.

Implementing Nested Classes.

Code Samples.

6. Interfaces and Packages.

Creating and Using Interfaces.

Creating and Using Packages.

Code Samples.

7. Handling Errors Using Exceptions.

What Is an Exception.

The Catch or Specify Requirement.

Catching and Handling Exceptions.

Specifying the Exceptions Thrown by a Method.

How to Throw Exceptions.

Runtime Exceptions - The Controversy.

Advantages of Exceptions.

Summary of Exceptions.

Questions and Exercises.

Code Samples.

8. Threads: Doing Two or More Tasks at Once.

What Is a Thread?

Using the Timer and TimerTask Classes.

Customizing a Thread's run Method.

The Life Cycle of a Thread.

Understanding Thread Priority.

Synchronizing Threads.

Grouping Threads.

Summary of Threads.

Questions and Exercises: Threads.

Code Samples.

9. I/O: Reading and Writing.

Overview of I/O Streams.

Using the Streams.

Object Serialization.

Working with Random Access Files.

And the Rest. . . .

Summary of Reading and Writing.

Questions and Exercises: Reading and Writing.

Code Samples.

10. User Interfaces that Swing.

Swing Overview.

Your First Swing Program.

Example Two: SwingApplication.

Example Three: CelsiusConverter.

Example Four: TravelWeather.

Example Five: Dialog Example.


Look & Feel.

Layout Management.

Threads and Swing.

Supporting Assistive Technologies.

Visual Index to Swing Components.


Questions and Exercises.

11. Applets for the Internet and Intranet.

Overview of Applets.

AWT Components.

Taking Advantage of the Applet API.

Practical Considerations of Writing Applets.

Finishing an Applet.

For More Information.

Questions and Exercises.

Appendix A. Common Problems and Their Solutions.

Getting Started Problems.

General Programming Problems.

Applet Problems.

User Interface Problems.

Appendix B. Collections.





Custom Implementations.


Appendix C. Deprecated Thread Methods.

Why Is Thread.stop Deprecated?

Why Are Thread.suspend and Thread.resume Deprecated?

What about Thread.destroy?

Why Is Runtime.runFinalizersOnExit Deprecated?

Appendix D. Reference.

Java Programming Language Keywords.

Operator Precedence.


POSIX Conventions for Command-Line Arguments.

Integrated Development Environments.

Classpath Help.

Index. 0201703939T04062001


Since the release of the Java Development Kit in May of 1995, the engineering team at Sun Microsystems has been hard at work improving and enhancing the Java platform. We have been similarly laboring to update The Java Tutorial to reflect the work of the engineers.

From the first page to the last, this edition now documents the APIs in the Java 2 SDK, Standard Edition, v 1.3. We have fully integrated SDK 1.3 updates into the text, plus we've added questions and exercises to help you practice what you learn. To help beginners avoid many common mistakes, an entire chapter is devoted to programming problems and their solutions. Convenient summaries at the end of each section are also new to this edition.

Like the first and second editions, this book is based on the online tutorial hosted at Sun Microsystem's Web site for the Java platform.


Like the online version, this book reflects the latest advances in Java technology. Unlike the online version, this book solely focuses on the APIs needed by most beginning to intermediate programmers. Once you've mastered the material in this book, you can explore the rest of the Java platform on the Web site.

Our intent has always been to create a fun, easy-to-read, task-oriented programmer's guide with lots of practical examples to help people learn to program.

Who Should Read This Book?

The book is geared towards both novice and experienced programmers.

  • New programmers can benefit most by reading the book from beginning to end, including the step by step instructions for compiling and running your first program in Getting Started (page 1).
  • Programmers experienced with procedural languages such as C may wish start with the material on object-oriented concepts and features of the Java programming language.
  • Experienced object programmers may want to jump feet first into more advanced trails, such as those on applets, essential classes, or user interfaces.

No matter what type of programmer you are, you can find a path through this book that fits your learning requirements.

How to Use This Book

This book is designed so that you can either read it straight through or skip around from topic to topic. Whenever a topic is discussed in another place, you'll see a link to that place in the tutorial. Links are underlined and are followed by page numbers, like this: What Can Java Technology Do? (page 5).

All the sample code used in this book is available online and on the accompanying CD. The CD icon in the margin indicates that the code is available. At the end of each chapter there is also a "Code Sample" section with a table that specifies the locations of the examples on the CD and online.

We're dedicated to keeping this book up-to-date with the most current information. To learn what's new since this book went to press, visit the following URL:




Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership