Home page of Holt Software Associates  | Home page of the Turing Programming Language, the fastest way to teach programming concepts  | Home page of Holt Software's Java products  | Home page of Ready to Program with Java(tm) Technology, a Java development environment designed for education  | Information about Holt Software's courses for teachers  | Information about how to contact Holt Software  | Information about how students can purchase Holt Software's books and software  | Information about how schools and bookstores can purchase Holt Software's books and software

Holt Software Books    [Graphical Version]  |  [Printer Friendly Version]

[Cover of Book]

Introduction to Programming in Java


Book Information

Title: Introduction to Programming in Java (First Edition)
Authors: J.N.Patterson Hume and Christine Stephenson
ISBN: 0-921598-39-4
Publisher: Holt Software Associates Inc.
Binding: Softcover
Pages: 754 pgs
Price: Bookstores & Schools: $39.95    Retail: $49.95
Ordering Information: For bookstores and schools, click here for ordering information.
For individuals click here for ordering information.
Program Examples: Found on CD included with book
Solutions Manual: Available [Click here for information on obtaining Solutions Manuals for Holt Software publications.]

Book Description

This is a definitive textbook for learning the fundamentals of programming in Java. Introduction to Programming in Java has been designed to introduce students to the fundamental principals and paradigms of computer science. It provides a comprehensive introduction to object-oriented concepts such as classes and inheritance and covers all the core topics including: input of data, control constructs, methods, strings, arrays, records, algorithms for sorting, and linked lists.

Introduction to Programming in Java also highlights the graphical capabilities of Java by providing chapters on the creation of applets, Java and HTML, and GUI applications. These chapters are of particular interest to students.

This text also facilitates student learning by providing case studies which take a step-by-step approach to the design of small and large applets and applications.

By using classes provided with the textbook to simplify textual input and output, Introduction to Programming in Java teaches the fundamentals of computer science without becoming mired in Java's complexities.

Introduction to Programming in Java comes with a CD containing Holt Software's Ready to Program with Java Technology, a full Java development environment designed specifically for education containing everything you need to write Java programs. The CD also contains the updated hsa class library and all the example classes found in the book.


Correlations with Ontario Computer Studies Curriculum

Holt Software has examined Introduction to Programming in Java and correlated it with the new Ontario Computer Studies Curriculum. The correlations of the book with the Grade 12 ICS4M course is available in PDF (Adobe Acrobat) format. The document lists the expectations for the course and the location in the book where the expectation is addressed.

If you have Adobe Acrobat Reader installed, then click on the link below. If you do not have Acrobat Reader, then you can obtain it free of charge by clicking the Get Acrobat Reader icon.

Get Acrobat Reader

Preface to Introduction to Programming in Java (First Edition)

This textbook, Introduction to Programming in Java, is intended to be used in a first computer science course in Java. It emphasizes the basic concepts of programming and the object-oriented programming paradigm. The programming language used in this book is Java.

Introduction to Programming in Java focuses on computing concepts with the ultimate goal of facilitating the broadest possible coverage of the core computer science curriculum. In an effort to provide material for courses covering the World Wide Web we have included an introductory chapter on creating web pages using HTML.

To begin, Java standalone application programs are used exclusively. Applets are covered in considerable detail in later chapters. Some of the more advanced notions of concurrency, exception handling, and graphical user interfaces have been omitted or are discussed in an abbreviated way.

This textbook package includes a CD containing the Ready to Program with Java Technology software. Ready is a complete integrated development environment for Java that provides all the power of Java without the complexities that confuse learners.

(Additional references should be consulted if a complete syntax of Java or the Java class libraries is required.)

Overview

This book covers the material in standard curricula for first courses in computer science. As well, it emphasizes the object-oriented paradigm.

The list of chapter titles outlines the arrangement of materials.

  1. Computing Essentials
  2. The Ready to Program with JavaTM Technology Environment
  3. Programming
  4. Programming in Java
  5. Basic Programming Language Concepts
  6. Input of Data
  7. Control Constructs
  8. Strings
  9. Methods
  10. Classes and Inheritance
  11. Applets and Graphical User Interfaces
  12. Creating Web Pages with HTML
  13. Arrays
  14. Advanced OO Concepts
  15. Records in Java
  16. Algorithms for Sorting Lists
  17. Self-Referential Classes and Linked Lists
  18. Advanced GUIs
Chapter 1 provides an overview of the history of modern computing, including hardware, software, programming languages, and number systems. By highlighting a number of key technological developments, it attempts to place Computer Engineering today in its scientific and social context. It also explores some of the current issues in computing such as employment, privacy, and access to information.

Chapter 2 describes how to use the Ready to Program with Java Technology environment. The way to create standalone Java program classes and Java applets is outlined. The chapter also covers how syntax errors are reported and how they are corrected.

Chapter 3 introduces some of the key ideas in computer science. As well as providing a description of programming, programming style, and the software development process it introduces the difference between the two major programming paradigms: the procedure-oriented paradigm and the object-oriented paradigm which is the paradigm of the Java programming language. Abstraction is introduced as a way of making programs easier to create and to understand.

Chapter 4 introduces a number of the basic elements of the Java syntax, particularly the idea of a class and a method. These are illustrated by graphic examples using the Console class. The details of all these concepts are explored in later chapters. Instructions are provided for the creation and running of Java standalone applications.

Chapter 5 presents the EBNF metalanguage for formally describing the syntax of a programming language. The primitive data types of the Java language are defined along with the way to declare variables of these types. Expressions for each type are also defined and the assignment statement presented. The chapter explains how values of the different types are output and formatted using the Console class. The role of comments in providing internal documentation to a program is also discussed.

Chapter 6 discusses how data can be input to a program. Ways in which a list of data items can be input by counted or conditional loops are shown. Input from the standard input, the keyboard, and input from a file are discussed. Ways to generate data, using random numbers, for purposes of testing programs are presented. The statistical analysis of numerical data is also described.

Chapter 7 deals with program structure. Algorithms can be programmed using three basic forms of control structure: linear sequence, repetition, and selection. The Java syntax for each of these is defined. The use of diagrams such as flow charts to supplement the program itself is discussed and shown to be unnecessary for a structured program which is properly paragraphed, and internally documented. Tracing execution of a program before trying to run it on a computer is encouraged

Chapter 8 introduces the string data structure which is implemented using the String class. Strings in Java are objects instantiated from the String class. Methods of the class are shown. The StringBuffer class is introduced as useful when the contents of a string are to be changed. The StringTokenizer class which permits the breaking of a string into tokens is illustrated.

Chapter 9 provides details about methods - components of a object that can be used by other objects to operate on the data of the original object. As with subprograms of earlier programming languages, methods fall into two principal classes: procedure-type methods that perform some action and function-type methods that yield a value. The differences in the way these two types of methods are defined and invoked is detailed. The relation between formal and actual parameters is explained. The scope of identifiers in a program is outlined. The signature, header, and specifications of a method are defined. Methods that call themselves (recursive methods) - and iterative methods that accomplish the same result - are dealt with. A case study illustrating the design of programs broken down into methods is provided.

Chapter 10 shows how an object can encapsulate data and the methods that operate on the data, and illustrates how other objects that use that object are prevented from interfering with the encapsulated data. The class is the template from which an object is instantiated. A constructor method of the class is used to create a new instance of the class - the object. Examples are given of using and creating a class. Inheritance is introduced as a means by which new classes are created through modifications of a base class. By using the Java library of classes, multiple objects of the class can be created or new classes produced.

Chapter 11 introduces Java applets. Applets are invoked by using a browser, such as Netscape NavigatorTM, and can be accessed through the World Wide Web. It is this feature of Java that is at the root of much of its popularity, as well as its being an object-oriented programming language. Graphical User Interfaces (GUIs) are introduced. This chapter covers many of the classes in Java's Abstract Windowing Toolkit (awt). A case study which examines the design decisions involved in the development of a GUI applet is provided.

Chapter 12 explores the creation of web pages using HTML (Hypertext Markup Language). The use of HTML to format information, create tables, place pictures, and display lists is discussed in some detail. The chapter also discusses the details controlling the presentation of an applet: its size, location on the screen, and so on.

Chapter 13 introduces the structured data type called an array. Individual elements of an array share the same name and data type but are distinguished from each other by having an index. An individual element of an array can be passed by value to a method whereas an entire array is passed, as any object is, by reference. When the method alters its array parameter the actual array is altered. The efficiencies of searching an array by a linear search and a sorted array by a binary search are compared.

Chapter 14 concentrates on the higher concepts of object-oriented programming. These include abstract classes, class hierarchies, genericity, and Java interfaces. Object-oriented analysis is emphasized. The chapter also deals with the realities of programming in Java such as resource constraints and trade-offs between resource usage and program flexibility.

Chapter 15 describes implementing records as objects and the reading from and writing to binary files. In Java, there is no standard way to store an object's fields in a record. As a result, it must be programmed The ways records can be input from or output to a file are shown, as is the storage of records in a binary form so that random access to individual records is possible. A simple linear search of an array of records is introduced as an example of using records.

Chapter 16 presents algorithms for sorting lists of data stored in arrays. A comparison of the sort using the various algorithms is explored. The chapter also explains how methods depending on recursion, are more efficient than simple exchange algorithms.

Chapter 17 gives details of self-referential classes and how they can be used to instantiate nodes to link objects together in simple linked lists. A List class is created and then modified to produce an OrderedList class by inheritance.

Chapter 18 introduces many of the more advanced features of the graphical interface capabilities of Java's Abstract Windowing Toolkit (awt) by guiding students through the construction of a movie ticket seller applet and a simple paint applet. A case study which illustrates the use of menus in the design of a GUI application is provided.

Appendix A is a case study focusing on the creation of a library automation system with an emphasis on object-oriented design. It covers the development of the design specifications, the determination of the classes and class hierarchies to be used, and the Java program development.

Conventions

This book uses a number of naming conventions for identifiers. These are not part of the Java language but are used to make programs understandable.

Flexibility

Introduction to Programming in Java has been organized to provide an introduction to the fundamental concepts of computer science. The object-oriented paradigm of the Java programming language is used to illustrate basic principles.

Differing course demands and student populations may require instructors to omit certain chapters or parts of chapters, or to insert additional material to cover some concepts in greater detail. For example, instructors wishing to address the historical information in Chapter 1 after students have more hands-on programming may choose to begin with a later chapter.

The Java Programming Language

Java is a programming language that was developed at Sun Microsystems. Java standalone application programs provide all the features of other general purpose languages such as Pascal or C. Java applets add the flexibility of sharing programs via the World Wide Web and Internet. Java is an object-oriented programming language and has been provided with an extensive library of classes that can be used in creating programs. This library is being rapidly extended by its many users.

The language is portable; it can be used on any computer platform that has a Java interpreter. This means that software developers can confidently program in Java and know that their software will run on any such computer. As well, individuals can also share applets via the Web. Attempts are made to make the use of shared programs safe. For security, for example, no applet may read from or write to a file on the system on which it is being executed.

Java syntax is based on the C syntax but many of the difficult and error prone parts of C and C++, such as pointers, operator overloading, and multiple inheritance have been eliminated. In this book we have eliminated still more of the "tricks" that some C programmers delight in. Our approach is based on the fundamental principle of structured programming, namely keeping programs easy to understand.

Java and its class libraries have many additional features which are not part of C or C++. It provides for strings, graphics, concurrency, and exception handling, as well as a large number of data structures in its class libraries. Java also provides graphical user interface classes.

All of these features contribute to Java's attractiveness as both a commercial software tool and a means of addressing the core computer science concepts.

Comments

Your comments, corrections, and suggestions are very welcome. Please feel free to contact us at:

Distribution Manager
Holt Software Associates Inc.
203 College Street, Suite 305
Toronto, Ontario, Canada M5T 1P9
E-mail: books@hsa.on.ca
USA or Canada phone: 1-800-361-8324
World Wide Web: http://www.holtsoft.com

Table of Contents of Introduction to Programming in Java

  • PREFACE
  • ACKNOWLEDGMENTS
  • Chapter 1 - COMPUTING ESSENTIALS
  • 1.1 Introduction
  • 1.2 A Brief History of Computer Hardware
  • 1.3 A Brief History of Programming
  • 1.3.1 A New Way of Organizing Large Programs
  • 1.4 What is a Computer?
  • 1.4.1 The Central Processing Unit
  • 1.4.2 Memory
  • 1.4.3 Output Devices
  • 1.5 Number Systems: Decimal and Binary
  • 1.6 Hardware and Networks
  • 1.6.1 Different Kinds of Computers for Different Needs
  • 1.6.2 The Silicon Chip
  • 1.7 Software
  • 1.7.1 Operating Systems
  • 1.7.2 Programming Environments
  • 1.7.3 Applications
  • 1.8 The Social Impact of Computers
  • 1.8.1 Employment
  • 1.8.2 Privacy
  • 1.8.3 Access to Information
  • 1.8.4 Leisure Activities
  • 1.8.5 Illegal Activity
  • 1.8.6 Computers: Good or Bad?
  • 1.9 Chapter Summary
  • 1.10 Technical Terms
  • 1.11 Exercises
  • Chapter 2 - THE READY TO PROGRAM WITH JAVA TECHNOLOGY IDE
  • 2.1 Beginning to Use Ready to Program with JavaTM Technology
  • 2.2 Organization of Java Programs
  • 2.3 Creating a New Application
  • 2.4 Compiling the Program
  • 2.5 Errors in the Program
  • 2.6 Running the Program
  • 2.7 Modifying Existing Programs
  • 2.8 Features of Ready
  • 2.8.1 Syntax Coloring
  • 2.8.2 Program Indentation
  • 2.8.3 One-Window Mode
  • 2.9 Further Documentation
  • Chapter 3 - PROGRAMMING
  • 3.1 Programming and Programmers
  • 3.2 Programming Style
  • 3.3 The Software Development Process
  • 3.4 Abstraction in Programs
  • 3.4.1 Procedural Abstraction
  • 3.4.2 Data Abstraction
  • 3.5 Programming Paradigms
  • 3.5.1 Procedure-Oriented Programming
  • 3.5.2 Object-Oriented Programming
  • 3.6 Key Concepts in Object-Oriented Programming
  • 3.6.1 Objects
  • 3.6.2 Classes
  • 3.6.3 Inheritance
  • 3.7 Chapter Summary
  • 3.8 Technical Terms
  • 3.9 Exercises
  • Chapter 4 - PROGRAMMING IN JAVA
  • 4.1 What is Java?
  • 4.2 Programming in Java
  • 4.2.1 Locating a Figure in the Console Window
  • 4.2.2 Drawing a Colored Rectangle in the Console Window
  • 4.3 Standalone Programs in Java
  • 4.4 User-Defined Methods
  • 4.4.1 Simple Examples of User-Defined Methods
  • 4.4.2 A More Complicated Example
  • 4.5 The Form of Java Application Programs
  • 4.6 Using a Boilerplate
  • 4.7 Chapter Summary
  • 4.8 Technical Terms
  • 4.9 Exercises
  • Chapter 5 - BASIC PROGRAMMING LANGUAGE CONCEPTS
  • 5.1 Metalanguage for Defining Syntax
  • 5.2 Primitive Data Types
  • 5.3 Declarations of Variables
  • 5.4 Expressions: Arithmetic and Boolean
  • 5.4.1 Arithmetic Expressions
  • 5.4.2 Boolean Expressions
  • 5.5 Assignment Statements
  • 5.5.1 Initializing Variables in their Declarations
  • 5.5.2 Constants
  • 5.5.3 Syntax of Assignment Statements
  • 5.5.4 Variable Names on Both Sides of an Assignment Statement
  • 5.6 Output Statements
  • 5.6.1 Output Formatting
  • 5.7 Comments in Programs
  • 5.8 Chapter Summary
  • 5.9 Technical Terms
  • 5.10 Exercises
  • Chapter 6 - INPUT OF DATA
  • 6.1 Entering Programs
  • 6.2 Standard Input and Output
  • 6.3 Input of Numerical Data
  • 6.4 Input of String Data
  • 6.5 Input of Sequences of Data
  • 6.5.1 Counted Repetition
  • 6.5.2 Conditional Repetition
  • 6.6 Input from a File
  • 6.7 Output to a File
  • 6.8 Generated Data
  • 6.9 Statistical Analysis of Data
  • 6.10 Chapter Summary
  • 6.11 Technical Terms
  • 6.12 Exercises
  • Chapter 7 - CONTROL CONSTRUCTS
  • 7.1 Structure within Methods
  • 7.2 Repetition Constructs
  • 7.2.1 The Counted Loop
  • 7.2.2 The Conditional Loop
  • 7.2.3 Testing of Loops
  • 7.3 Basic Selection Constructs
  • 7.4 Flow Charts
  • 7.5 Tracing Execution
  • 7.6 Another Selection Construct
  • 7.7 Checking Input Data
  • 7.8 Common Programming Errors
  • 7.9 Chapter Summary
  • 7.10 Technical Terms
  • 7.11 Exercises
  • Chapter 8 - STRINGS
  • 8.1 The String Data Type
  • 8.2 Declaring String Objects
  • 8.3 Concatenation of Strings
  • 8.4 Replacing Characters in Strings
  • 8.5 Searching for Patterns in Strings
  • 8.6 Comparing Strings
  • 8.7 The StringBuffer Class
  • 8.8 The StringTokenizer Class
  • 8.9 Text Processing
  • 8.10 Chapter Summary
  • 8.11 Technical Terms
  • 8.12 Exercises
  • Chapter 9 - METHODS
  • 9.1 Kinds of Methods
  • 9.2 Calling a Method in a Program
  • 9.3 Defining a Method
  • 9.3.1 Labelling Methods and Variables as Static
  • 9.4 Access to Instance Variables
  • 9.5 Scope of Identifiers
  • 9.6 Testing of Programs
  • 9.7 Tracing of Methods
  • 9.8 Function Methods
  • 9.9 Method Overloading
  • 9.10 Recursive Methods
  • 9.11 An Example Using Methods
  • 9.12 Function Methods with Side Effects
  • 9.13 A Case Study Involving Methods
  • 9.13.1 Specification of Problem to be Solved
  • 9.13.2 Design of the User Interface
  • 9.13.3 Program Design
  • 9.13.4 Stepwise Refinement
  • 9.13.5 Further Refinement - Encrypting a Letter
  • 9.13.6 The Java Program
  • 9.14 Chapter Summary
  • 9.15 Technical Terms
  • 9.16 Exercises
  • Chapter 10 - CLASSES AND INHERITANCE
  • 10.1 Objects and Abstract Data Types
  • 10.2 Using a Class
  • 10.3 Creating the Turtle Class
  • 10.4 Instantiating Two Objects from a Class
  • 10.5 Method Overloading
  • 10.6 Creating a New Class by Inheritance
  • 10.6.1 Using the Modified Class
  • 10.7 Class Hierarchy
  • 10.8 Chapter Summary
  • 10.9 Technical Terms
  • 10.10 Exercises
  • Chapter 11 - APPLETS AND GRAPHICAL USER INTERFACES
  • 11.1 The Structure of an Applet
  • 11.2 Applets with No Input
  • 11.3 Applets with User Input and Output with GUI
  • 11.4 Applets with Multiple GUI Components
  • 11.5 Layout of GUI Components
  • 11.6 Other GUI Components
  • 11.7 Graphics Using Applets
  • 11.8 Simple Animation
  • 11.9 A Case Study Using GUIs and Graphics
  • 11.9.1 Problem Specification
  • 11.9.2 User Interface - Component Selection
  • 11.9.3 User Interface - Placement of Components
  • 11.9.4 The Program
  • 11.10 Chapter Summary
  • 11.11 Technical Terms
  • 11.12 Exercises
  • Chapter 12 - CREATING WEB PAGES WITH HTML
  • 12.1 The Hypertext Markup Language
  • 12.2 Markup Tags
  • 12.3 HTML Documents
  • 12.4 HTML Tags for Formatting Text
  • 12.5 Linked Web Pages
  • 12.6 Tables in Web Pages
  • 12.7 Images in Web Pages
  • 12.8 Applets in Web Pages
  • 12.9 An Example Web Page with Applets
  • 2.10 Chapter Summary
  • 12.11 Technical Terms
  • 12.12 Exercises
  • Chapter 13 - ARRAYS
  • 13.1 Lists as Arrays
  • 13.1.1 Frequency Distribution
  • 13.1.2 A Class for Maintaining a List of Names
  • 13.1.3 Computing Prime Numbers
  • 13.2 Related Lists
  • 13.3 Declaration of Arrays
  • 13.4 Two-Dimensional Arrays
  • 13.5 Methods With Array Parameters
  • 13.6 Searching
  • 13.7 Efficiency of Algorithms
  • 13.7.1 Sequential Search Time
  • 13.7.2 Binary Search Time
  • 13.8 Chapter Summary
  • 13.9 Technical Terms
  • 13.10 Exercises
  • Chapter 14 - ADVANCED OBJECT ORIENTED CONCEPTS
  • 14.1 Separate Classes for Drawing Shapes
  • 14.2 An Abstract Shape Class as a Base Class
  • 14.3 Method Overloading in the Base Class
  • 14.4 Adding Methods to a Base Class
  • 14.5 Improving Efficiency of Extended Classes
  • 14.6 Class Hierarchies
  • 14.7 Java Interfaces
  • 14.8 Chapter Summary
  • 14.9 Technical Terms
  • 14.10 Exercises
  • Chapter 15 - RECORDS IN JAVA
  • 15.1 Records
  • 15.2 Arrays of Records
  • 15.2.1 Two-Dimensional Arrays of Records
  • 15.3 Storing Records in Binary Files
  • 15.4 Example of Using a Binary File
  • 15.5 Records with Alternative Sets of Fields
  • 15.6 Chapter Summary
  • 15.7 Technical Terms
  • 15.8 Exercises
  • Chapter 16 - ALGORITHMS FOR SORTING LISTS
  • 16.1 What is Sorting?
  • 16.2 Insertion Sort
  • 16.3 Selection Sort
  • 16.4 Bubble Sort
  • 16.4.1 Top Down Design of Bubble Sort
  • 16.4.2 Improving Bubble Sort
  • 16.5 Running Time for Sorting Algorithms
  • 16.6 Merge Sort
  • 16.6.1 The Nature of Recursion
  • 16.7 Quicksort
  • 16.8 Chapter Summary
  • 16.9 Technical Terms
  • 16.10 Exercises
  • Chapter 17 - SELF-REFERENTIAL CLASSES AND LINKED LISTS
  • 17.1 Links
  • 17.2 Singly Linked Lists
  • 17.3 A List Class
  • 17.3.1 Sample Execution of Demonstration Program
  • 17.4 Implementation of List Class
  • 17.5 Ordered Lists
  • 17.5.1 Sample Execution of Demonstration Program
  • 17.6 Chapter Summary
  • 17.7 Technical Terms
  • 17.8 Exercises
  • Chapter 18 - ADVANCED GUIS
  • 18.1 The MovieWicket Example Problem
  • 18.2 Layout of GUIs
  • 18.3 Layout for the MovieWicket Applet
  • 18.4 Implementation of the Actions of the Applet
  • 18.5 Drawing Using the Mouse
  • 18.6 GUIs with Java Applications
  • 18.7 Menus
  • 18.8 A Case Study Involving GUIs in a Java Application
  • 18.8.1 Problem
  • 18.8.2 User Interface - Windows
  • 18.8.3 User Interface - Component Selection
  • 18.8.4 User Interface - Placement
  • 18.8.5 User Interface - Other Issues
  • 18.8.6 The Program
  • 18.9 Chapter Summary
  • 18.10 Exercises
  • APPENDICES
  • Appendix A : Library Automation System Case Study
  • A.1 The Problem Specification
  • A.2 Specifications for the Library Information System
  • A.3 The User Interface
  • A.4 Choosing Objects and Classes
  • A.5 Choosing Fields and Methods for Each Class
  • A.6 The Program Design
  • A.7 The Program
  • A.8 Exercises
  • Appendix B : Reserved Words
  • Appendix C : Java Class Library
  • Classes Sorted by Package
  • Descriptions
  • Appendix D : HSA Class Library
  • Appendix E : Operators
  • Mathematical Operators
  • Boolean Operators
  • Bit Manipulation Operators
  • Operator Precedence
  • Appendix F : Applet Syntax
  • Appendix G : Application Syntax
  • Appendix H : Installing the Ready to Program Java IDE
  • Appendix I : License Agreement for the Ready to Program Java IDE
  • Appendix J : Web Resources for Java
  • INDEX

  • [ Holt Software Home ] * [ Books (Graphical) ] * [ Books (Text) ] * [ Top of Page ] * [ Feedback ]