Holt Software Books [Graphical Version] | [Printer Friendly Version]
![[Cover of Book]](img/prog_concept_java_vaj.jpg) |
Programming Concepts in Java, Second Edition
(VisualAge Java Edition)
|
| Title: |
Programming Concepts in Java (Second Edition) |
| Authors: |
J.N.Patterson Hume and Christine Stephenson |
| ISBN: |
0-921598-32-7 |
| Publisher: |
Holt Software Associates Inc. in association with
IBM's Centre for Advanced Studies |
| Binding: |
Softcover |
| Pages: |
575 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: |
Partial Available [Click here for
information on obtaining Solutions Manuals for Holt Software
publications.] |
Designed for a first course in computer science in colleges and
universities, Programming Concepts in Java emphasizes
the basic concepts, principles and paradigms of computer science
while using the Java language.
By using classes provided with the textbook to simplify textual
input and output, Programming Concepts in Java teaches
the fundamentals of computer science without becoming mired in
Java's complexities.
In doing so, it covers concepts such as input of data, control constructs,
methods, classes and inheritance, strings, applets, arrays, records,
algorithms for sorting, linked lists, and trees.
Recognizing that Java's popularity with students rests with its ability
to produce graphics applications and applets, Programming Concepts in
Java also has chapters covering the creation of applets and GUI
applications, as well as a chapter covering the details of the classes
used earlier in the book.
Programming Concepts in Java comes with a CD containing IBM's
VisualAge for Java for Windows 2.0 (Professional version) licensed
for use with the book and related courses and an additional suite of tools and
classes (Console, PrintFiles, PrettyPrint and others) as well as all
of the example classes contained in the book.
Preface to Programming Concepts in Java (Second Edition)
This textbook, Programming Concepts in Java, is intended to be used in a first
course in computer science. It emphasizes the basic concepts of programming
and the object-oriented programming paradigm. No previous knowledge of
programming is needed, although some contact with computers and operating
environments, such as Microsoft Windows 95, 98 or NT would be an asset.
The programming language used in this book is Java. The environment presented
is the IBM VisualAge for Java, Professional Edition for Windows, Version 2.0
system. The primary focus of this book is computing concepts with the ultimate
goal of facilitating the broadest possible coverage of the core computer
science curriculum. (Additional references should be consulted if a complete
syntax of Java or the Java class libraries is required.) Also, some of the
more advanced notions of concurrency, exception handling, and graphical user
interfaces have had to be omitted or discussed in an abbreviated way. To
begin, Java standalone application programs are used exclusively. Applets are
covered in considerable detail in later chapters. The final chapter provides a
detailed example of building a graphical user interface to an application
using the Java class libraries.
This textbook package includes a CD containing the full professional version
of IBM's VisualAge for Java, Professional Edition for Windows, Version 2.0
software. In addition, the publisher has provided a collection of Java classes
to facilitate the teaching of Java. These include the Console class which
enables students to do text and graphics I/O without having to master the
intricacies of the Java Abstract Windowing Toolkit. As well, the collection
includes the Stdin class, which allows students to read all of Java's
primitive data types from the standard input stream without having to master
Java data type conversion. There are also classes for pretty printing
(paragraphing) Java programs, reading Java primitive data types from text
files, and submitting programs for marking. A complete set of the classes
presented as examples in this book is also available on the CD.
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.
- Programming Paradigms
- The VisualAge for Java Environment
- Basic Programming Language Concepts
- Input of Data
- Control Constructs
- Strings
- Methods
- Classes and Inheritance
- Applets and Graphical User Interfaces
- Arrays
- Records in Java
- Algorithms for Sorting Lists
- Self-Referential Classes and Linked Lists
- Trees
- VisualAge for Java Visual Builder
- Advanced GUIs: the Console Class
Chapter 1 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. A
number of the basic elements of the Java syntax are introduced, 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.
Chapter 2 presents the IBM VisualAge for Java, Professional Edition for
Windows, Version 2.0 environment. The way to begin a project in the Workbench
using the SmartGuide of VisualAge for Java is outlined, as is the way to enter
standalone Java program classes with methods. The chapter also covers how
syntax errors are reported when programs are saved and can be corrected by
editing. The use of a shared computer system is explained.
Chapter 3 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 The
chapter explains how values of the different types are output and formatted
using a Console class. The role of comments in providing internal
documentation to a program is also discussed.
Chapter 4 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 5 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. The VisualAge for Java Debugger facility is
described.
Chapter 6 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
introduced.
Chapter 7 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 - and iterative methods that accomplish
the same result - are dealt with.
Chapter 8 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 9 introduces Java applets. Applets are invoked by using a
browser, such as Netscape Navigator, 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. The
VisualAge for Java method of creating Graphical User Interfaces (GUIs) is
introduced. This chapter covers many of the classes in Java's Abstract
Windowing Toolkit (awt).
Chapter 10 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 11 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 fixed length 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 12 presents algorithms for sorting lists of data stored in
arrays. The time complexity of sorting algorithms is explored and big O
notation introduced. The chapter also explains how methods depending on
recursion prove to be more efficient than simple exchange algorithms.
Chapter 13 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 14 introduces the binary tree as a data structure that has a
recursive definition and is easily implemented by having two links in a node.
The chapter demonstrates how the efficiency of searching achieved with a
sorted array using a binary search, and the ease of insertion and deletion of
elements in a linear linked list is possible with a binary search tree. The
heap sort is introduced as a recursive method of sorting which uses trees
defined somewhat differently than binary search trees.
Chapter 15 introduces VisualAge for Java, Professional Edition for
Windows, Version 2.0 Visual Builder tool by guiding students through the
construction of a movie ticket seller applet. The chapter demonstrates how
student-created methods can be integrated with visual design tools.
Chapter 16 provides a detailed example of building a graphical user
interface. It examines a simplified version of the Console class to introduce
Java's Abstract Windowing Toolkit.
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.
- All identifiers that are multiple words use an upper case
letter to begin all words after the first
- Class names have the first letter capitalized.
- Variable and method names have identifiers beginning with a
lower case letter.
- Constants have identifiers all in upper case.
Flexibility
Programming Concepts 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, the discussion of algorithm complexity and big O notation
can easily be omitted from the course of study. The instructor may
wish to provide other resources if more than an introduction to
program correctness or the use of Java on the Internet is desired.
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. 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.
IBM VisualAge for Java 2.0
While this book may be used with any Java product, the Java environment
discussed and included with the book is IBM's VisualAge for Java, Professional
Edition for Windows, Version 2.0. This environment provides a convenient way
to enter and save Java programs, both standalone applications and applets. The
creation of the files for classes is handled automatically by the environment.
It also has a debugging facility.
Perhaps, more significantly, VisualAge for Java, Professional Edition for
Windows, Version 2.0 provides an excellent graphic interface which allows
students to create applets which support graphical user interfaces (GUIs).
For more information and educational resources see:
www.ibm.com/java/academic
Table of Contents of Programming Concepts in Java
PREFACE
ACKNOWLEDGMENTS
Chapter 1 - PROGRAMMING PARADIGMS
1.1 What is Java?
1.2 What is Programming?
1.3 Abstraction in Programs
Procedural Abstraction
Data Abstraction
1.4 Programming Paradigms
Procedure-Oriented Programming
Object-Oriented Programming
1.5 Key Concepts in Object-Oriented Programming
Objects
Classes
Inheritance
1.6 Programming in Java
Locating a Figure in the Console Window
Drawing a Colored Rectangle in the Console Window
1.7 Standalone Programs in Java
1.8 User-Defined Methods
Simple Examples of User-Defined Methods
A More Complicated Example
1.9 The Form of Application Programs
1.10 Chapter Summary
Steps in Programming
Procedural Abstraction
Data Abstraction
Object-Oriented Programming
Objects, Classes, and Inheritance
Graphics Procedures
User-Defined Methods
Structure Charts
Other Java Syntax
1.11 Exercises
Chapter 2 - THE VISUALAGE FOR JAVA ENVIRONMENT
2.1 Beginning to Use VisualAge for Java
Organization of VisualAge for Java
Starting a Project
2.2 Entering an Application Program
2.3 Errors in Programs
2.4 Running Programs
2.5 Modifying an Existing Program
2.6 Programs with Several Methods
2.7 Running on a Shared Computer
2.8 Manipulating Classes or Methods
Printing
Deleting a Class
Copying a Class
Renaming a Class
2.9 List of Commands in Workbench Menu
File menu
Edit menu
Workspace menu
Selected menu (for Classes)
Selected menu (for Methods)
Window menu
Help menu
2.10 Chapter Summary
Workbench
Starting
Creating Classes and Methods
Running Programs
Using the BoilerPlate Class
Including More Methods than a main
Running on a Shared Computer
Manipulating Classes or Methods
Chapter 3 - BASIC PROGRAMMING LANGUAGE CONCEPTS
3.1 Metalanguage for Defining Syntax
3.2 Primitive Data Types
3.3 Declarations of Variables
3.4 Expressions: Arithmetic and Boolean
Arithmetic Expressions
Boolean Expressions
3.5 Assignment Statements
Initializing Variables in their Declarations
Constants
Syntax of Assignment Statements
Variable Names on Both Sides of an Assignment Statement
3.6 Output Statements
Output Formatting
3.7 Comments in Programs
3.8 Chapter Summary
Metalanguage for Syntax Definition
Primitive Data Types and Declarations
Arithmetic Expressions
Boolean Expressions
Assignment Statements
Output Statements
Comments
3.9 Exercises
Chapter 4 - INPUT OF DATA
4.1 Entering Programs
4.2 Standard Input and Output
4.3 Input of Numerical Data
4.4 Input of String Data
4.5 Input of Sequences of Data
Counted Repetition
Conditional Repetition
4.6 Input from a File
4.7 Output to a File
4.8 Generated Data
4.9 Statistical Analysis of Data
4.10 Chapter Summary
Entering Programs
Input of Data
Input of Sequences of Data
Input from a File
Output to a File
Generated Data
Statistical Analysis of Data
4.11 Exercises
Chapter 5 - CONTROL CONSTRUCTS
5.1 Structure within Methods
5.2 Repetition Constructs
The Counted Loop
Testing of Loops
Proving Loop Correctness
5.3 Basic Selection Constructs
5.4 Flow Charts
5.5 Tracing Execution
Using the VA Java Debugger
5.6 Another Selection Construct
5.7 Checking Input Data
5.8 Common Programming Errors
5.9 Chapter Summary
Control Constructs
Flow Charts
Repetition Constructs
Selection Constructs
Tracing Execution
The Switch Construct
Checking Bad Data
5.10 Exercises
Chapter 6 - STRINGS
6.1 The String Data Type
6.2 Declaring String Objects
6.3 Concatenation of Strings
6.4 Replacing Characters in Strings
6.5 Searching for Patterns in Strings
6.6 Comparing Strings
6.7 The StringBuffer Class
6.8 The StringTokenizer Class
6.9 Text Processing
6.10 Chapter Summary
The String Data Type
String Methods
Searching for Patterns in String Objects
Comparing Strings
The StringBuffer Class
The StringTokenizer Class
6.11 Exercises
Chapter 7 - METHODS
7.1 Kinds of Methods
7.2 Calling a Method in a Program
7.3 Defining a Method
Labelling Methods and Variables as Static
7.4 Access to Instance Variables
7.5 Scope of Identifiers
7.6 Testing of Programs
7.7 Tracing of Methods
7.8 Function Methods
7.9 Method Overloading
7.10 Recursive Methods
7.11 An Example Using Methods
7.12 Function Methods with Side Effects
7.13 Chapter Summary
Types of Methods
Defining Methods
Local Identifiers, Global Identifiers, and Parameters
Testing of Programs
Tracing of Programs
Recursive Methods
7.14 Exercises
Chapter 8 - CLASSES AND INHERITANCE
8.1 Objects and Abstract Data Types
8.2 Using a Class
8.3 Creating the Turtle Class
8.4 Instantiating Two Objects from a Class
8.5 Method Overloading
8.6 Creating a New Class by Inheritance
Using the Modified Class
8.7 Class Hierarchy
8.8 Chapter Summary
Abstract Data Types
Using an Object
The Turtle Object
Classes
Creating a New Class by Inheritance
8.9 Exercises
Chapter 9 - APPLETS AND GRAPHICAL USER INTERFACES
9.1 The Structure of an Applet
9.2 Applets with no Input or GUI
9.3 Applets with User Input and Output with GUI
9.4 Applets with Multiple GUI Components
9.5 Layout of GUI Components
9.6 Other GUI Components
9.7 Graphics Using Applets
9.8 Simple Animation
9.9 An Example Using GUIs and Graphics
9.10 Chapter Summary
Applets
Applets with Input and Output and GUI
Applets with Multiple GUIs
Layout of GUI Components
Other GUI Components
Graphics Using Applets
Simple Animation 230
Complex Graphical User Interfaces
9.11 Exercises
Chapter 10 - ARRAYS
10.1 Lists as Arrays
Frequency Distribution
A Class for Maintaining a List of Names
Computing Prime Numbers
10.2 Related Lists
10.3 Declaration of Arrays
10.4 Two-Dimensional Arrays
10.5 Methods With Array Parameters
10.6 Searching
10.7 Efficiency of Algorithms
Running Time for Sequential Search
Running Time for Binary Search
Big O Notation
Concentrating on Loops and Recursion
10.8 Chapter Summary
Lists as Arrays
Related Lists
Declaration of Arrays
Tables as Arrays
Methods With Array Parameters
Searching
Efficiency of Algorithms
10.9 Exercises
Chapter 11 - RECORDS IN JAVA
11.1 Records
11.2 Arrays of Records
Two-Dimensional Arrays of Records
11.3 Storing Records in Binary Files
11.4 Example of Using a Binary File
11.5 Records with Alternative Sets of Fields
11.6 Chapter Summary
Records as Objects
Array of Records
Example of Using Records
Storing Records in Binary Files
Searching a Random Access File
Records with Alternative Sets of Fields
11.7 Exercises
Chapter 12 - ALGORITHMS FOR SORTING LISTS
12.1 What is Sorting?
12.2 Insertion Sort
12.3 Selection Sort
12.4 Bubble Sort
Top Down Design of Bubble Sort
Improving Bubble Sort
12.5 Running Time for Sorting Algorithms
Running Time for Bubble Sort
Running Time of Insert and Selection Sort
12.6 Merge Sort
The Nature of Recursion
12.7 Quicksort
12.8 Chapter Summary
Insertion Sort
Selection Sort
Bubble Sort
Recursive Sorts
Merge Sort
Quicksort
Timing of Recursive Sorts
12.9 Exercises
Chapter 13 - SELF-REFERENTIAL CLASSES AND LINKED LISTS
13.1 Links
13.2 Singly Linked Lists
13.3 A List Class
Sample Execution of Demonstration Program
13.4 Implementation of List Class
13.5 Ordered Lists
Sample Execution of Demonstration Program
13.6 Chapter Summary
Links
List Class
Linked List Implementation of List Class
Ordered Lists
13.7 Exercises
Chapter 14 - TREES
14.1 Binary Search Trees
14.2 An Implementation of the Ordered List Using a Tree
14.3 Deleting a Node from a Tree
14.4 Using a Binary Tree to Sort: Heap Sort
14.5 Chapter Summary
Binary Search Trees
Sorting Using a Binary Search Tree
Heaps
Implementing a Heap Using an Array
Sorting Using a Heap
14.6 Exercises
Chapter 15 - VISUALAGE FOR JAVA VISUAL BUILDER
15.1 JavaBeans
15.2 Beginning to use the Visual Builder
15.3 Positioning, Sizing, and Aligning Beans
15.4 Adding more Beans
15.5 Adding Methods to the Applet
15.6 Adding Connections between Beans
15.7 Using Other JavaBeans
15.8 Connections
15.9 Chapter Summary
JavaBeans
Status Area
Tool Bar
Connections
Other Java Beans
15.10 Exercises
Chapter 16 - ADVANCED GUIS: THE CONSOLE CLASS
16.1 The Console Class
16.2 The BaseConsole Class
16.3 Methods of BaseConsole for Graphics
16.4 Methods of BaseConsole for Basic Text Input
16.5 Methods of BaseConsole Class for Output
16.6 Methods of BaseConsole for Input
16.7 The BaseConsoleCanvas Class
16.8 Chapter Summary
The BaseConsole Class
Text Handling
Windows
16.9 Exercises
APPENDICES
Appendix A : Reserved Words
Appendix B : Java Class Library
Classes Sorted by Package
Descriptions
Appendix C : HSA Class Library
Appendix D : Operators
Mathematical Operators
Boolean Operators
Bit Manipulation Operators
Operator Precedence
Appendix E : Applet Syntax
Appendix F : Application Syntax
Appendix G : Installing VisualAge for Java
Licensing Agreement
Hardware Requirements
Software Requirements
Installing VisualAge for Java
Installing the Holt Software and the Book Examples Projects
Using the hsa Package and the Book Examples in Other Environments
Appendix H : License Agreement for VisualAge for Java
Appendix I : Web Resources for Java
INDEX
[ Holt Software Home ] *
[ Books (Graphical) ] *
[ Books (Text) ] *
[ Top of Page ] *
[ Feedback ]