Introduction to Programming Using Java,
Third Edition (Version 3.1)

Preface


"INTRODUCTION TO PROGRAMMING WITH 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 are no prerequisites beyond a general familiarity with the ideas of computers and programs.

This text uses the Java programming language as the language of instruction. It requires Java version 1.1 or higher. 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. It is certainly not a Java reference book, and it is not even a comprehensive survey of all the features of Java. It is not 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.

This is the third edition of Introduction to Programming with Java. The first two editions have been used by the author and by another professor in the introductory programming class at Hobart and William Smith Colleges (http://www.hws.edu/). The new edition is a major upgrade. It is more than twice the size of the second edition. Changes include:

With these changes, Introduction to Programming with Java is now fully competitive, in the author's opinion, 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 textbook differs from many other Java programming books in that it does not deal primarily with applets. Early chapters concentrate on standalone applications that use text input and output. Applets are introduced briefly in Section 3.7 and covered pretty thoroughly in Chapter 6 and Chapter 7. In the remaining chapters, applets are used in many but not all examples and exercises. "Swing," a new set of interface components introduced in Java 1.2, is just barely mentioned (in Section 7.8). This approach allows a gentler introduction to fundamental programming concepts, and it postpones the complexities of graphical user interface programming until a time when students are ready to deal with them. The decision to do things this way also reflects the fact that applets are only one aspect of Java, and probably not the most important.

I do not plan any further major upgrades to this textbook, but I will probably release new versions in the future with minor revisions and corrections. The current edition of Introduction to Programming with Java will always be available at the following Web address:

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

Version 3.1 (February 2001) is a minor upgrade to Version 3.0 (May 2000). It incorporates corrections to a few errors in Version 3.0. (See the Version 3.0 errata page for a list.) The major change is that with Version 3.1, modification and republication is now covered by the terms of the Open Publication License.

The first, second, and third editions are permanently archived at the following 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/


Downloading the Text

The complete Introduction to Programming with Java is available for download as a compressed archive for the Windows, Macintosh, or Linux/Unix platforms. (Text files have slightly different formats on the three platforms. The text files in each archive are in the appropriate format for the platform. For many purposes, though, the difference is unimportant. For example, Web browsers will accept files in any of the formats.) The uncompressed archives contain 580 files and directories and take up over four megabytes of space. You should be able to download an archive by clicking on one of the following links. If you have problems with the downloading, please let me know!

An archive must be uncompressed to be useful. To do this, you will need appropriate software (which might already be on your computer). For Windows, you can use WinZip, available from www.winzip.com. WinZip is shareware, but you can use it for a 30 day trial without charge. Alternatively, you might want to get the free program, Aladdin Expander for Windows from www.aladdinsys.com, which can also be used to uncompress the Windows archive. For Macintosh, you need Stuffit Expander for Macintosh, which is already included with most Web browsers. In fact, your Web browser might uncompress the archive automatically when you download it. If you don't have it, Stuffit Expander can be downloaded from www.aladdinsys.com. The software for Linux/UNIX should already be included on your system. To decode the archive javanotes3.tar.Z, use the command "uncompress javanotes3.tar.Z" followed by the command "tar xf javanotes3.tar".

I recommend reading Introduction to Programming with Java with a Web browser, so that you can see and use the applets that occur throughout the text. However, I know from experience that a lot of people will want to print all or part of the text. To make this a little easier, I've made a large PDF file that contains the entire textbook, except for the Java source code files from Appendix 3 and the solutions to the quizzes and programming exercises. Of course, the PDF file does not display the applets in the text. Where they should appear, you'll generally see a message such as "Sorry, but your browser does not support Java." A PDF file can be viewed or printed using the free program, Adobe Acrobat Reader. (The file was created using the "Web Capture" feature in Adobe Acrobat Pro 4.0. This is nothing fancy -- just all the Web pages captured in a single file.) The PDF file is available through the following link. It is more than 1.8 megabytes in size, and it contains more than 500 pages of text.

If there is a PDF viewer built into your browser, clicking on the above link will show the file in your Web browser window. In that case, to download the file, try right-clicking or Control-clicking the link. This should bring up a menu that contains a command such as "Save this link". Selecting that command will allow you to download the file to your hard disk.


Usage Restrictions

Introduction to Programming with Java is free, but it is not in the public domain. As of Version 3.1, it is published under the terms of the Open Publication License. (For the purpose of this license, I am both the publisher and author of the work.) This license allows redistribution and modification under certain terms. For example, you can:

While it is not actually required by the license, I do appreciate hearing from people who are using or distributing my work.

Professor David J. Eck
Department of Mathematics and Computer Science
Hobart and William Smith Colleges
Geneva, New York 14456, USA
Email: eck@hws.edu
WWW: http://math.hws.edu/eck/

May 23, 2000
Modified February 18, 2001


[ Main Index ]