Preface

Table of Contents

1. Changes from the Previous Edition
2. Usage Restrictions

"INTRODUCTION TO PROGRAMMING USING JAVA" is a free, on-line textbook. It is suitable for use in an introductory programming course and for people who are trying to learn programming on their own. There is probably enough material for a full year College programming course. There are no prerequisites beyond a general familiarity with the ideas of computers and programs.

In style, this is a textbook rather than a tutorial. That is, it concentrates on explaining concepts rather than giving step-by-step how-to-do-it guides. I have tried to use a conversational writing style that might be closer to classroom lecture than to a typical textbook. You'll find programming exercises at the end of most chapters, and you will find a detailed solution for each exercise, with the sort of discussion that I would give if I presented the solution in class. (I strongly advise that you read the exercise solutions if you want to get the most out of this book.) This is certainly not a Java reference book, and it is not even close to a comprehensive survey of all the features of Java. It is not written as a quick introduction to Java for people who already know another programming language. Instead, it is directed mainly towards people who are learning programming for the first time, and it is as much about general programming concepts as it is about Java in particular. I believe that Introduction to Programming using Java is fully competitive with the conventionally published, printed programming textbooks that are available on the market. (Well, all right, I'll confess that I think it's better.)

This version of the book covers "Java 2", the version of Java that was introduced with version 1.2 of the Java Software Development Kit. It was written using version 1.3 of the development kit and should work with later versions as well. The current version, which as of July 2002 is J2SE SDK 1.4.0, can be downloaded from Sun Microsystem's Java page at http://java.sun.com/. ("J2SE SDK 1.4.0" stands for Java 2 Standard Edition Software Development Kit Version 1.4.0, and it is often referred to by its older acronym, JDK, which stands for Java Development Kit. Sun has not exactly been sensible about the way it names things.)

There are several approaches to teaching Java. One approach uses applets and graphical user interface programming from the very beginning. Some people believe that object oriented programming should also be emphasized from the very beginning. This is not the approach that I take. The approach that I favor starts with the more basic building blocks of programming and builds from there. I cover procedural programming in Chapters 2, 3, and 4. Object-oriented programming is introduced in Chapter 5. Chapters 6 and 7 cover the closely related topic of event-oriented programming and graphical user interfaces. Arrays are covered in Chapter 8, with more coverage of data structures in Chapters 11 and 12. Chapter 10 covers files and input/output streams. Chapter 9 covers exception handling, which is a prerequisite for using files in Java, and uses the opportunity for a more general discussion of the problem of writing correct and robust programs.

The current edition of Introduction to Programming using Java will always be available at the following Web address:

http://math.hws.edu/javanotes/

All editions are still available and are permanently archived at the following Web addresses:

First edition: http://math.hws.edu/eck/cs124/javanotes1/

Second edition: http://math.hws.edu/eck/cs124/javanotes2/

Third edition: http://math.hws.edu/eck/cs124/javanotes3/

Fourth edition: http://math.hws.edu/eck/cs124/javanotes4/