| |
| |
Foreword | |
| |
| |
Introduction | |
| |
| |
Prerequisites | |
| |
| |
Learning Java | |
| |
| |
Goals | |
| |
| |
Online documentation | |
| |
| |
Chapters | |
| |
| |
Exercises | |
| |
| |
Multimedia CD ROM | |
| |
| |
Source code | |
| |
| |
Java versions | |
| |
| |
Seminars and mentoring | |
| |
| |
Errors | |
| |
| |
Note on the cover design | |
| |
| |
Acknowledgements | |
| |
| |
| |
Introduction to objects | |
| |
| |
The progress of abstraction | |
| |
| |
An object has an interface | |
| |
| |
The hidden implementation | |
| |
| |
Reusing the implementation | |
| |
| |
Inheritance: reusing the interface | |
| |
| |
Interchangeable objects with polymorphism | |
| |
| |
Object landscapes and lifetimes | |
| |
| |
Exception handling: dealing with errors | |
| |
| |
Multithreading | |
| |
| |
Persistence | |
| |
| |
Java and the Internet | |
| |
| |
Analysis and Design | |
| |
| |
Java vs. C++? | |
| |
| |
| |
Everything is an object | |
| |
| |
You manipulate objects with handles | |
| |
| |
You must create all the objects | |
| |
| |
You never need to destroy an object | |
| |
| |
Creating new data types: class | |
| |
| |
Methods, arguments and return values | |
| |
| |
Building a Java program | |
| |
| |
Your first Java program | |
| |
| |
Comments and embedded documentation | |
| |
| |
Coding style | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Controlling program flow | |
| |
| |
Using Java operators | |
| |
| |
Execution control | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Initialization and cleanup | |
| |
| |
Guaranteed initialization with the constructor | |
| |
| |
Method overloading | |
| |
| |
Cleanup: finalization and garbage collection | |
| |
| |
Member initialization | |
| |
| |
Array initialization | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Hiding the implementation | |
| |
| |
package: the library unit | |
| |
| |
Java access specifiers | |
| |
| |
Interface and implementation | |
| |
| |
class access | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Reusing classes | |
| |
| |
Composition syntax | |
| |
| |
Inheritance syntax | |
| |
| |
Combining composition and inheritance | |
| |
| |
Choosing composition vs. inheritance | |
| |
| |
protected | |
| |
| |
Incremental development | |
| |
| |
Upcasting | |
| |
| |
The final keyword | |
| |
| |
Initialization and class loading | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Polymorphism | |
| |
| |
Upcasting | |
| |
| |
The twist | |
| |
| |
Overriding vs. overloading | |
| |
| |
Abstract classes and methods | |
| |
| |
Interfaces | |
| |
| |
Inner classes | |
| |
| |
Constructors and polymorphism | |
| |
| |
Designing with inheritance | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Holding your objects | |
| |
| |
Arrays | |
| |
| |
Collections | |
| |
| |
Enumerators (iterators) | |
| |
| |
Types of collections | |
| |
| |
Sorting | |
| |
| |
The generic collection library | |
| |
| |
The new collections | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Error handling with exceptions | |
| |
| |
Basic exceptions | |
| |
| |
Catching an exception | |
| |
| |
Standard Java exceptions | |
| |
| |
Creating your own exceptions | |
| |
| |
Exception restrictions | |
| |
| |
Performing cleanup with finally | |
| |
| |
Constructors | |
| |
| |
Exception matching | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
The Java IO system | |
| |
| |
Input and output | |
| |
| |
Adding attributes and useful interfaces | |
| |
| |
Off by itself: RandomAccessFile | |
| |
| |
The File class | |
| |
| |
Typical uses of IO streams | |
| |
| |
Stream Tokenizer | |
| |
| |
Java 1.1 IO streams | |
| |
| |
Compression | |
| |
| |
Object serialization | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Run-time type identification | |
| |
| |
The need for RTTI | |
| |
| |
RTTI syntax | |
| |
| |
Reflection: run-time class information | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Passing and returning objects | |
| |
| |
Passing handles around | |
| |
| |
Making local copies | |
| |
| |
Controlling cloneability | |
| |
| |
Read-only classes | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Creating windows and applets | |
| |
| |
Why use the AWT? | |
| |
| |
The basic applet | |
| |
| |
Making a button | |
| |
| |
Capturing an event | |
| |
| |
Text fields | |
| |
| |
Text areas | |
| |
| |
Labels | |
| |
| |
Check boxes | |
| |
| |
Radio buttons | |
| |
| |
Drop-down lists | |
| |
| |
List boxes | |
| |
| |
Controlling layout | |
| |
| |
Alternatives to action | |
| |
| |
Applet restrictions | |
| |
| |
Windowed applications | |
| |
| |
The new AWT | |
| |
| |
Java 1.1 UI APIs | |
| |
| |
Visual programming and Beans | |
| |
| |
Introduction to Swing | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Multiple threads | |
| |
| |
Responsive user interfaces | |
| |
| |
Sharing limited resources | |
| |
| |
Blocking | |
| |
| |
Priorities | |
| |
| |
Runnable revisited | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Network programming | |
| |
| |
Identifying a machine | |
| |
| |
Sockets | |
| |
| |
Serving multiple clients | |
| |
| |
Datagrams | |
| |
| |
A Web application | |
| |
| |
Connecting Java to CGI | |
| |
| |
Connecting to databases with JDBC | |
| |
| |
Remote methods | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Design patterns | |
| |
| |
The pattern concept | |
| |
| |
The observer pattern | |
| |
| |
Simulating the trash recycler | |
| |
| |
Improving the design | |
| |
| |
Abstracting usage | |
| |
| |
Multiple dispatching | |
| |
| |
The "visitor" pattern | |
| |
| |
RTTI considered harmful? | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Projects | |
| |
| |
Text processing | |
| |
| |
A method lookup tool | |
| |
| |
Complexity theory | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Using non-Java code | |
| |
| |
The Java Native Interface | |
| |
| |
The Microsoft way | |
| |
| |
J/Direct | |
| |
| |
Raw Native Interface (RNI) | |
| |
| |
Java/COM integration | |
| |
| |
CORBA | |
| |
| |
Summary | |
| |
| |
| |
Comparing C++ and Java | |
| |
| |
| |
Java programming guidelines | |
| |
| |
| |
Performance | |
| |
| |
Basic approach | |
| |
| |
Locating the bottleneck | |
| |
| |
Speedup techniques | |
| |
| |
References | |
| |
| |
| |
A bit about garbage collection | |
| |
| |
| |
Recommended reading | |
| |
| |
Index | |