| |
| |
Preface | |
| |
| |
New Features in the Second Edition | |
| |
| |
Major Features | |
| |
| |
Supplement Materials | |
| |
| |
Book Organization | |
| |
| |
Acknowledgments | |
| |
| |
| |
Introduction to Computers and Programming Languages | |
| |
| |
| |
A History of Computers | |
| |
| |
| |
Computer Architecture | |
| |
| |
| |
Programming Languages | |
| |
| |
| |
Java | |
| |
| |
| |
Exercises | |
| |
| |
| |
Introduction to Object-Oriented Programming and Software Development | |
| |
| |
| |
Classes and Objects | |
| |
| |
| |
Messages and Methods | |
| |
| |
| |
Class and Instance Data Values | |
| |
| |
| |
Inheritance | |
| |
| |
| |
Software Engineering and Software Life Cycle | |
| |
| |
| |
Having Fun with Java | |
| |
| |
| |
Exercises | |
| |
| |
| |
Java Programming Basics | |
| |
| |
| |
The First Java Application | |
| |
| |
| |
Program Components | |
| |
| |
| |
Edit--Compile--Run Cycle | |
| |
| |
| |
The javabook Package | |
| |
| |
| |
Sample Program: Displaying Messages | |
| |
| |
| |
The First Java Applet | |
| |
| |
| |
Exercises | |
| |
| |
| |
Numerical Data | |
| |
| |
| |
Variables | |
| |
| |
| |
Arithmetic Expressions | |
| |
| |
| |
Constants | |
| |
| |
| |
The Math Class | |
| |
| |
| |
InputBox | |
| |
| |
| |
OutputBox | |
| |
| |
| |
Sample Program: Loan Calculator | |
| |
| |
| |
Numerical Representation (Optional) | |
| |
| |
| |
Exercises | |
| |
| |
| |
Defining Instantiable Classes | |
| |
| |
| |
Defining Instantiable Classes | |
| |
| |
| |
Instantiable Classes and Constructors | |
| |
| |
| |
Visibility Modifiers: public and private | |
| |
| |
| |
Local Variables, Return Values, and Parameter Passing | |
| |
| |
| |
Loan Calculator Program with an Instantiable Class | |
| |
| |
| |
Exercises | |
| |
| |
| |
Processing Input with Applets | |
| |
| |
| |
Placing GUI Objects on Applets | |
| |
| |
| |
Adding ActionListener to an Event Source | |
| |
| |
| |
Absolute Positioning of GUI Objects | |
| |
| |
| |
The Button Class | |
| |
| |
| |
Converting Text to a Numerical Value | |
| |
| |
| |
Sample Program: Finding Body Mass Index (BMI) | |
| |
| |
| |
Running an Applet as an Application | |
| |
| |
| |
Exercises | |
| |
| |
| |
Selection Statements | |
| |
| |
| |
The if Statement | |
| |
| |
| |
Boolean Expressions and Variables | |
| |
| |
| |
Nested-if Statements | |
| |
| |
| |
ListBox | |
| |
| |
| |
The switch Statement | |
| |
| |
| |
Sample Program: Drawing Shapes | |
| |
| |
| |
Exercises | |
| |
| |
| |
Repetition Statements | |
| |
| |
| |
The while Statement | |
| |
| |
| |
Pitfalls in Writing Repetition Statements | |
| |
| |
| |
The do--while Statement | |
| |
| |
| |
ResponseBox | |
| |
| |
| |
The for Statement | |
| |
| |
| |
Nested-for Statements | |
| |
| |
| |
The Format Class | |
| |
| |
| |
Loan Tables | |
| |
| |
| |
Sample Program: Hi-Lo Game | |
| |
| |
| |
Recursive Methods (Optional) | |
| |
| |
| |
Exercises | |
| |
| |
| |
Characters and Strings | |
| |
| |
| |
Characters | |
| |
| |
| |
Strings | |
| |
| |
| |
Primitive versus Reference Types | |
| |
| |
| |
StringBuffer | |
| |
| |
| |
Passing Objects as Parameters | |
| |
| |
| |
Returning an Object from Methods | |
| |
| |
| |
Sample Program: Word Play | |
| |
| |
| |
Exercises | |
| |
| |
| |
Arrays | |
| |
| |
| |
Array Basics | |
| |
| |
| |
Arrays of Objects | |
| |
| |
| |
Passing Arrays to Methods | |
| |
| |
| |
MultilnputBox | |
| |
| |
| |
Self-Referencing Pointer | |
| |
| |
| |
Sample Development: The Address Book | |
| |
| |
| |
Two-Dimensional Arrays | |
| |
| |
| |
Vectors | |
| |
| |
| |
Exercises | |
| |
| |
| |
Sorting and Searching | |
| |
| |
| |
Searching | |
| |
| |
| |
Sorting | |
| |
| |
| |
Heapsort | |
| |
| |
| |
Sample Program: Sorting an AddressBook | |
| |
| |
| |
Exercises | |
| |
| |
| |
File Input and Output | |
| |
| |
| |
File and FileDialog Objects | |
| |
| |
| |
Low-Level File I/O | |
| |
| |
| |
High-Level File I/O | |
| |
| |
| |
Handling Exceptions | |
| |
| |
| |
Object I/O | |
| |
| |
| |
Sample Class: Saving an AddressBook Object | |
| |
| |
| |
Exercises | |
| |
| |
| |
Reusable Classes and Packages | |
| |
| |
| |
Object Categories | |
| |
| |
| |
Method Overriding and Overloaded Methods | |
| |
| |
| |
Sample Classes: Reusable EggyPeggy and HiLo | |
| |
| |
| |
Package Organization | |
| |
| |
| |
Exercises | |
| |
| |
| |
GUI Objects and Event-Driven Programming | |
| |
| |
| |
Placing Buttons on a Frame | |
| |
| |
| |
Handling Events | |
| |
| |
| |
Placing TextField Objects on a Frame | |
| |
| |
| |
Menus | |
| |
| |
| |
Handling Mouse Events | |
| |
| |
| |
Other GUI Objects | |
| |
| |
| |
Sample Program: A Simple Calculator | |
| |
| |
| |
Exercises | |
| |
| |
| |
Inheritance and Polymorphism | |
| |
| |
| |
Defining Classes with Inheritance | |
| |
| |
| |
Using Classes Effectively with Polymorphism | |
| |
| |
| |
Inheritance and Member Accessibility | |
| |
| |
| |
Inheritance and Constructors | |
| |
| |
| |
Abstract Superclasses and Abstract Methods | |
| |
| |
| |
When and When Not to Use Inheritance | |
| |
| |
| |
Sample Program: Computing Course Grades | |
| |
| |
| |
Exercises | |
| |
| |
| |
Class Roster Maintenance Program | |
| |
| |
| |
Method Call Sequence Diagram | |
| |
| |
| |
Problem Statement | |
| |
| |
| |
Overall Planning | |
| |
| |
| |
Step 1 Development: Program Shell with Menus | |
| |
| |
| |
Step 2 Development: Create a New Roster | |
| |
| |
| |
Step 3 Development: Add Students | |
| |
| |
| |
Step 4 Development: Delete Students | |
| |
| |
| |
Step 5 Development: Edit Student Names | |
| |
| |
| |
Step 6 Development: Edit Test Scores and Compute Grades | |
| |
| |
| |
Step 7 Development: Display Student Information | |
| |
| |
| |
Step 8 Development: Storing Grade Rosters | |
| |
| |
| |
Step 9 Development: Finalize and Improve | |
| |
| |
| |
The StudentNameDialog Class | |
| |
| |
| |
The TestScoreDialog Class | |
| |
| |
| |
Exercises | |
| |
| |
| |
Recursive Algorithms | |
| |
| |
| |
Basic Elements of Recursion | |
| |
| |
| |
Directory Listing | |
| |
| |
| |
Anagram | |
| |
| |
| |
Towers of Hanoi | |
| |
| |
| |
Quicksort | |
| |
| |
| |
When Not to Use Recursion | |
| |
| |
| |
Exercises | |
| |
| |
| |
The javabook Package | |