| |
| |
Preface to 1st Edition | |
| |
| |
Preface to 2nd Edition | |
| |
| |
Overview | |
| |
| |
Acknowledgement | |
| |
| |
| |
Introduction | |
| |
| |
| |
Object-Oriented Programming | |
| |
| |
| |
Objects and Their Interactions in the Real World | |
| |
| |
| |
Objects and Their Interactions in Programming | |
| |
| |
| |
Simulation | |
| |
| |
| |
Java | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Object, Class, Message and Method | |
| |
| |
| |
Objects and Class | |
| |
| |
| |
Message and Method | |
| |
| |
| |
Message Components | |
| |
| |
| |
Method | |
| |
| |
| |
Client and Server | |
| |
| |
| |
Creating Objects | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
A Quick Tour of Java | |
| |
| |
| |
Primitive Types | |
| |
| |
| |
Object Definition | |
| |
| |
| |
Variable Definitions | |
| |
| |
| |
Methods | |
| |
| |
| |
Object Instantiation | |
| |
| |
| |
Object Access and Message Passing | |
| |
| |
| |
Representational Independence | |
| |
| |
| |
Overloading | |
| |
| |
| |
Initialization and Constructors | |
| |
| |
| |
Expressions, Statements, and Control-flow Mechanisms | |
| |
| |
| |
Operators | |
| |
| |
| |
Expression Statements | |
| |
| |
| |
Control-flow Statements | |
| |
| |
| |
Blocks | |
| |
| |
| |
Local Declarations | |
| |
| |
| |
More Control-flow Statements | |
| |
| |
| |
Arrays | |
| |
| |
| |
Result Returned by Method | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Implementation in Java | |
| |
| |
| |
Calculator | |
| |
| |
| |
The clear() Method | |
| |
| |
| |
The display() Method | |
| |
| |
| |
The digit() Method | |
| |
| |
| |
Operator Methods | |
| |
| |
| |
Code Execution | |
| |
| |
| |
Simple User Interface | |
| |
| |
| |
Another Interface for Calculator Engine | |
| |
| |
| |
Event-Driven Programming | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Classification, Generalization, and Specialization | |
| |
| |
| |
Classification | |
| |
| |
| |
Hierarchical Relationship of Classes | |
| |
| |
| |
Superclass and Subclass | |
| |
| |
| |
A Class Hierarchy Diagram | |
| |
| |
| |
Generalization | |
| |
| |
| |
Specialization | |
| |
| |
| |
Organization of Class Hierarchy | |
| |
| |
| |
Abstract and Concrete Classes | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Inheritance | |
| |
| |
| |
Common Properties | |
| |
| |
| |
Inheritance | |
| |
| |
| |
Implementing Inheritance | |
| |
| |
| |
Code Reuse | |
| |
| |
| |
Making Changes in Class Hierarchy | |
| |
| |
| |
Change in Property Definition for All Subclasses | |
| |
| |
| |
Change in Property Definition for Some Subclasses | |
| |
| |
| |
Adding/Deleting a Class | |
| |
| |
| |
Accessing Inherited Properties | |
| |
| |
| |
Inheritance Chain | |
| |
| |
| |
Multiple Inheritance | |
| |
| |
| |
Problems Associated with Multiple Inheritance | |
| |
| |
| |
Contract and Implementation Parts | |
| |
| |
| |
Contract and Implementation Inheritance | |
| |
| |
| |
Interface | |
| |
| |
| |
Multiple Inheritance Using Interface | |
| |
| |
| |
Attributes in an Interface | |
| |
| |
| |
Methods in an Interface | |
| |
| |
| |
Abstract Class and Interface | |
| |
| |
| |
Extending Interface | |
| |
| |
| |
Limitations of Interface for Multiple Inheritance | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Polymorphism | |
| |
| |
| |
Static Binding | |
| |
| |
| |
Dynamic Binding | |
| |
| |
| |
Operation Overloading | |
| |
| |
| |
Same Method Signature | |
| |
| |
| |
Overloading Method Names | |
| |
| |
| |
Polymorphism | |
| |
| |
| |
Selection of Method | |
| |
| |
| |
Incremental Development | |
| |
| |
| |
Increased Code Readability | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Modularity | |
| |
| |
| |
Methods and Classes as Program Units | |
| |
| |
| |
Object and Class Properties | |
| |
| |
| |
Counting Instances | |
| |
| |
| |
Shared Attributes | |
| |
| |
| |
Class Attributes | |
| |
| |
| |
Class Methods | |
| |
| |
| |
Name Aliases | |
| |
| |
| |
Controlling Visibility | |
| |
| |
| |
Packages | |
| |
| |
| |
The package Keyword | |
| |
| |
| |
The import Keyword | |
| |
| |
| |
Encapsulation | |
| |
| |
| |
Bundling and Information Hiding | |
| |
| |
| |
Enhanced Software Maintainability | |
| |
| |
| |
Trade-Off | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Exception Handling | |
| |
| |
| |
Using Exceptions | |
| |
| |
| |
Exception Terminology | |
| |
| |
| |
Constructs and Exception Semantics in Java | |
| |
| |
| |
Defining Exception Objects | |
| |
| |
| |
Defining Exception Handlers | |
| |
| |
| |
Raising Exceptions | |
| |
| |
| |
A Simple Example | |
| |
| |
| |
Paradigms for Exception Handling | |
| |
| |
| |
Multiple Handlers | |
| |
| |
| |
Regular Exception Handling | |
| |
| |
| |
Accessing Exception Objects | |
| |
| |
| |
Subconditions | |
| |
| |
| |
Nested Exception Handlers | |
| |
| |
| |
Layered Condition Handling | |
| |
| |
| |
Code Finalization and Cleaning Up | |
| |
| |
| |
Object Finalization | |
| |
| |
| |
Block Finalization | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Input and Output Operations | |
| |
| |
| |
An Introduction to the Java API | |
| |
| |
| |
Reading the Java API Documentation | |
| |
| |
| |
Basic Input and Output | |
| |
| |
| |
File Manipulation | |
| |
| |
| |
File Input | |
| |
| |
| |
File Output | |
| |
| |
| |
Printing Using PrintStream | |
| |
| |
| |
Framework for Code Reuse | |
| |
| |
| |
DataInputStream and DataOutputStream Byte Stream Class | |
| |
| |
| |
Character Stream Classes | |
| |
| |
| |
Tokenizing the Input Using the Scanner Class | |
| |
| |
| |
Formatting the Output Using the Format String | |
| |
| |
| |
The File Class | |
| |
| |
| |
Random Access File Operations | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Networking and Multithreading | |
| |
| |
| |
The Network Model | |
| |
| |
| |
Sockets in Java | |
| |
| |
| |
Example Client: Web Page Retriever | |
| |
| |
| |
Listener Sockets in Java | |
| |
| |
| |
Example Server: Simple Web Server | |
| |
| |
| |
Running the Web Server | |
| |
| |
| |
Considering Multiple Threads of Execution | |
| |
| |
| |
Creating Multiple Threads of Execution | |
| |
| |
| |
Thread Creation Using the Thread Class | |
| |
| |
| |
Thread Creation Using the Runnable Interface | |
| |
| |
| |
Improvement of Web Server Example | |
| |
| |
| |
Thread Synchronization and Shared Resources | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Generics and Collections Framework | |
| |
| |
| |
Introduction | |
| |
| |
| |
Rationale Behind Generics | |
| |
| |
| |
The Problem | |
| |
| |
| |
Run-time Type Identification (RTTI) | |
| |
| |
| |
Java Generics | |
| |
| |
| |
Generic Class | |
| |
| |
| |
Generic Method | |
| |
| |
| |
Collections Framework | |
| |
| |
| |
Collections Interface | |
| |
| |
| |
ArrayList Class | |
| |
| |
| |
HashSet Class | |
| |
| |
| |
HashMap Class | |
| |
| |
| |
Sorting Collections | |
| |
| |
| |
Sort Algorithm | |
| |
| |
| |
Comparator Interface | |
| |
| |
| |
Searching Collections | |
| |
| |
| |
indexOf and contains Methods | |
| |
| |
| |
binarySearch Method | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Graphical Interfaces and Windows | |
| |
| |
| |
The AWT Model | |
| |
| |
| |
Basic AWT Constituents | |
| |
| |
| |
Frames | |
| |
| |
| |
Components | |
| |
| |
| |
Panels | |
| |
| |
| |
Layout in Panels | |
| |
| |
| |
Events | |
| |
| |
| |
Events in JDK 1.1 (and later versions) | |
| |
| |
| |
Basic Components | |
| |
| |
| |
Label Component | |
| |
| |
| |
Button Component | |
| |
| |
| |
Checkbox Component | |
| |
| |
| |
CheckboxGroup Component | |
| |
| |
| |
TextArea Component | |
| |
| |
| |
Choice Component | |
| |
| |
| |
List Component | |
| |
| |
| |
Menus and Menu Items | |
| |
| |
| |
Dialog Frames | |
| |
| |
| |
File Dialog Frames | |
| |
| |
| |
Custom Components | |
| |
| |
| |
Other Kinds of Class Definitions | |
| |
| |
| |
Inner Classes | |
| |
| |
| |
Anonymous Classes | |
| |
| |
| |
Local Classes | |
| |
| |
| |
Swing Components | |
| |
| |
| |
Transiting from AWT to Swing | |
| |
| |
| |
Model versus View | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Applets and Loaders | |
| |
| |
| |
Applet Characteristics | |
| |
| |
| |
Applet Life Cycle | |
| |
| |
| |
Custom Applets | |
| |
| |
| |
Images and Audio | |
| |
| |
| |
Animation in Applets | |
| |
| |
| |
Efficient Repainting | |
| |
| |
| |
Applet Parameters | |
| |
| |
| |
Loading Code Dynamically | |
| |
| |
| |
Security Restrictions for Untrusted Code | |
| |
| |
| |
Security Policy | |
| |
| |
| |
Keys | |
| |
| |
| |
Permissions | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Java Servlets | |
| |
| |
| |
Dynamic Web Pages and Servlets | |
| |
| |
| |
Tomcat Installation | |
| |
| |
| |
Downloading and Installation | |
| |
| |
| |
Configuration | |
| |
| |
| |
Starting and Stopping Tomcat | |
| |
| |
| |
Sample Servlet | |
| |
| |
| |
Servlet Characteristics | |
| |
| |
| |
Servlet Paramters and Headers | |
| |
| |
| |
Servlet Output | |
| |
| |
| |
Handling Sessions | |
| |
| |
| |
Session Timeout | |
| |
| |
| |
Concurrency | |
| |
| |
| |
Customized Processors | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Object Serialization and Remote Method Invocation | |
| |
| |
| |
Object Serialization | |
| |
| |
| |
Components in Object Serialization | |
| |
| |
| |
Custom Serialization | |
| |
| |
| |
The Externalizable Interface | |
| |
| |
| |
Distributed Computing with Java | |
| |
| |
| |
RMI and CORBA | |
| |
| |
| |
Java Limitations | |
| |
| |
| |
An Overview of Java RMI | |
| |
| |
| |
Using Java RMI | |
| |
| |
| |
Setting Up the Environment on Your Local Machine | |
| |
| |
| |
How RMI Works | |
| |
| |
| |
An RMI Example | |
| |
| |
| |
RMI System Architecture | |
| |
| |
| |
Under the Hood | |
| |
| |
| |
RMI Deployment | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
| |
Java Database Connectivity | |
| |
| |
| |
Introduction | |
| |
| |
| |
Java Database Connectivity | |
| |
| |
| |
JDBC Architecture | |
| |
| |
| |
JDBC Drivers | |
| |
| |
| |
Types of Drivers | |
| |
| |
| |
JDBC APIs | |
| |
| |
| |
Establishing a Connection | |
| |
| |
| |
Data Manipulation | |
| |
| |
| |
Data Definition Language (DDL) with JDBC | |
| |
| |
| |
Creating a Table | |
| |
| |
| |
Dropping a Table | |
| |
| |
| |
Data Manipulation Language (DML) with JDBC | |
| |
| |
| |
Creating (Inserting) Records Using JDBC | |
| |
| |
| |
Deleting Records Using JDBC | |
| |
| |
| |
Retrieving Records Using JDBC | |
| |
| |
| |
Updating Records Using JDBC | |
| |
| |
| |
Updatable Result Sets | |
| |
| |
| |
Prepared Statements | |
| |
| |
| |
Summary | |
| |
| |
| |
Exercises | |
| |
| |
Index | |