| |
| |
Preface | |
| |
| |
| |
Introduction to Computers, the Internet and the Web | |
| |
| |
| |
Introduction | |
| |
| |
| |
What Is a Computer? | |
| |
| |
| |
Computer Organization | |
| |
| |
| |
Evolution of Operating Systems | |
| |
| |
| |
Personal, Distributed and Client/Server Computing | |
| |
| |
| |
Machine Languages, Assembly Languages and High-Level Languages | |
| |
| |
| |
History of C++ | |
| |
| |
| |
History of Java | |
| |
| |
| |
Java Class Libraries | |
| |
| |
| |
FORTRAN, COBOL, Pascal and Ada | |
| |
| |
| |
BASIC, Visual Basic, Visual C++, C# and .NET | |
| |
| |
| |
The Internet and the World Wide Web | |
| |
| |
| |
Basics of a Typical Java Environment | |
| |
| |
| |
General Notes about Java and This Book | |
| |
| |
| |
Thinking About Objects: Introduction to Object Technology and the Unified Modeling Language | |
| |
| |
| |
Discovering Design Patterns: Introduction | |
| |
| |
| |
Introduction to Java Applications | |
| |
| |
| |
Introduction | |
| |
| |
| |
A First Program in Java: Printing a Line of Text | |
| |
| |
| |
Modifying Our First Java Program | |
| |
| |
| |
Displaying Text in a Dialog Box | |
| |
| |
| |
Another Java Application: Adding Integers | |
| |
| |
| |
Memory Concepts | |
| |
| |
| |
Arithmetic | |
| |
| |
| |
Decision Making: Equality and Relational Operators | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Examining the Problem Statement | |
| |
| |
| |
Introduction to Java Applets | |
| |
| |
| |
Introduction | |
| |
| |
| |
Sample Applets from the Java 2 Software Development Kit | |
| |
| |
| |
Simple Java Applet: Drawing a String | |
| |
| |
| |
Drawing Strings and Lines | |
| |
| |
| |
Adding Floating-Point Numbers | |
| |
| |
| |
Java Applet Internet and World Wide Web Resources | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Identifying the Classes in a Problem Statement | |
| |
| |
| |
Control Statements | |
| |
| |
| |
Introduction | |
| |
| |
| |
Algorithms | |
| |
| |
| |
Pseudocode | |
| |
| |
| |
Control Structures | |
| |
| |
| |
If Single-Selection Statement | |
| |
| |
| |
If...else Selection Statement | |
| |
| |
| |
While Repetition Statement | |
| |
| |
| |
Formulating Algorithms: Case Study 1 (Counter-Controlled Repetition) | |
| |
| |
| |
Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 2 (Sentinel-Controlled Repetition) | |
| |
| |
| |
Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 3 (Nested Control Structures) | |
| |
| |
| |
Compound Assignment Operators | |
| |
| |
| |
Increment and Decrement Operators | |
| |
| |
| |
Primitive Types | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Identifying Class Attributes | |
| |
| |
| |
Control Statements: Part 2 | |
| |
| |
| |
Introduction | |
| |
| |
| |
Essentials of Counter-Controlled Repetition | |
| |
| |
| |
For Repetition Statement | |
| |
| |
| |
Examples Using the for Statement | |
| |
| |
| |
Do...while Repetition Statement | |
| |
| |
| |
Switch Multiple-Selection Statement | |
| |
| |
| |
Break and continue Statements | |
| |
| |
| |
Labeled break and continue Statements | |
| |
| |
| |
Logical Operators | |
| |
| |
| |
Structured Programming Summary | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Identifying Objects' States and Activities | |
| |
| |
| |
Methods | |
| |
| |
| |
Introduction | |
| |
| |
| |
Program Modules in Java | |
| |
| |
| |
Math-Class Methods | |
| |
| |
| |
Method Declarations | |
| |
| |
| |
Argument Promotion | |
| |
| |
| |
Java API Packages | |
| |
| |
| |
Random-Number Generation | |
| |
| |
| |
Example: A Game of Chance | |
| |
| |
| |
Scope of Declarations | |
| |
| |
| |
Methods of Class JApplet | |
| |
| |
| |
Method Overloading | |
| |
| |
| |
Recursion | |
| |
| |
| |
Example Using Recursion: The Fibonacci Series | |
| |
| |
| |
Recursion vs. Iteration | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Identifying Class Operations | |
| |
| |
| |
Arrays | |
| |
| |
| |
Introduction | |
| |
| |
| |
Arrays | |
| |
| |
| |
Declaring and Creating Arrays | |
| |
| |
| |
Examples Using Arrays | |
| |
| |
| |
References and Reference Parameters | |
| |
| |
| |
Passing Arrays to Methods | |
| |
| |
| |
Sorting Arrays | |
| |
| |
| |
Searching Arrays: Linear Search and Binary Search | |
| |
| |
| |
Multidimensional Arrays | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Collaboration Among Objects | |
| |
| |
| |
Object-Based Programming | |
| |
| |
| |
Introduction | |
| |
| |
| |
Implementing a Time Abstract Data Type with a Class | |
| |
| |
| |
Class Scope | |
| |
| |
| |
Controlling Access to Members | |
| |
| |
| |
Referring to the Current Object's Members with this | |
| |
| |
| |
Initializing Class Objects: Constructors | |
| |
| |
| |
Using Overloaded Constructors | |
| |
| |
| |
Using Set and Get Methods | |
| |
| |
| |
Composition | |
| |
| |
| |
Garbage Collection | |
| |
| |
| |
Static Class Members | |
| |
| |
| |
Final Instance Variables | |
| |
| |
| |
Creating Packages | |
| |
| |
| |
Package Access | |
| |
| |
| |
Software Reusability | |
| |
| |
| |
Data Abstraction and Encapsulation | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Starting to Program the Classes for the Elevator Simulation | |
| |
| |
| |
Object-Oriented Programming: Inheritance | |
| |
| |
| |
Introduction | |
| |
| |
| |
Superclasses and Subclasses | |
| |
| |
| |
Protected Members | |
| |
| |
| |
Relationship between Superclasses and Subclasses | |
| |
| |
| |
Case Study: Three-Level Inheritance Hierarchy | |
| |
| |
| |
Constructors and Finalizers in Subclasses | |
| |
| |
| |
Software Engineering with Inheritance | |
| |
| |
| |
Object-Oriented Programming: Polymorphism | |
| |
| |
| |
Introduction | |
| |
| |
| |
Relationships Among Objects in an Inheritance Hierarchy | |
| |
| |
| |
Polymorphism Examples | |
| |
| |
| |
Abstract Classes and Methods | |
| |
| |
| |
Case Study: Inheriting Interface and Implementation | |
| |
| |
| |
Final Methods and Classes | |
| |
| |
| |
Case Study: Payroll System Using Polymorphism | |
| |
| |
| |
Case Study: Creating and Using Interfaces | |
| |
| |
| |
Nested Classes | |
| |
| |
| |
Type-Wrapper Classes for Primitive Types | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Incorporating Inheritance into the Elevator Simulation | |
| |
| |
| |
(Optional) Discovering Design Patterns: Introducing Creational, Structural and Behavioral Design Patterns | |
| |
| |
| |
Strings and Characters | |
| |
| |
| |
Introduction | |
| |
| |
| |
Fundamentals of Characters and Strings | |
| |
| |
| |
Class String | |
| |
| |
| |
Class StringBuffer | |
| |
| |
| |
Class Character | |
| |
| |
| |
Class StringTokenizer | |
| |
| |
| |
Card Shuffling and Dealing Simulation | |
| |
| |
| |
Regular Expressions, Class Pattern and Class Matcher | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Event Handling | |
| |
| |
| |
Graphics and Java2D | |
| |
| |
| |
Introduction | |
| |
| |
| |
Graphics Contexts and Graphics Objects | |
| |
| |
| |
Color Control | |
| |
| |
| |
Font Control | |
| |
| |
| |
Drawing Lines, Rectangles and Ovals | |
| |
| |
| |
Drawing Arcs | |
| |
| |
| |
Drawing Polygons and Polylines | |
| |
| |
| |
Java2D API | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Designing Interfaces with the UML | |
| |
| |
| |
Graphical User Interface Components | |
| |
| |
| |
Introduction | |
| |
| |
| |
Overview of Swing Components | |
| |
| |
| |
JLabel | |
| |
| |
| |
Event Handling | |
| |
| |
| |
Textfields | |
| |
| |
| |
How Event Handling Works | |
| |
| |
| |
JButton | |
| |
| |
| |
JCheckBox and JRadioButton | |
| |
| |
| |
JComboBox | |
| |
| |
| |
JList | |
| |
| |
| |
Multiple-Selection Lists | |
| |
| |
| |
Mouse Event Handling | |
| |
| |
| |
Adapter Classes | |
| |
| |
| |
Key Event Handling | |
| |
| |
| |
Layout Managers | |
| |
| |
| |
Panels | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Use Cases | |
| |
| |
| |
Graphical User Interface Components: Part 2 | |
| |
| |
| |
Introduction | |
| |
| |
| |
JTextArea | |
| |
| |
| |
Creating a Customized Subclass of JPanel | |
| |
| |
| |
JPanel Subclass that Handles Its Own Events | |
| |
| |
| |
JSlider | |
| |
| |
| |
Windows: Additional Notes | |
| |
| |
| |
Using Menus with Frames | |
| |
| |
| |
JPopupMenu | |
| |
| |
| |
Pluggable Look-and-Feel | |
| |
| |
| |
JDesktopPane and JInternal Frame | |
| |
| |
| |
JTabbedPane | |
| |
| |
| |
Layout Managers: BoxLayout and GridBagLayout | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Model-View-Controller | |
| |
| |
| |
(Optional) Discovering Design Patterns: Design Patterns Used in Packages java.awt and javax.swing | |
| |
| |
| |
Exception Handling | |
| |
| |
| |
Introduction | |
| |
| |
| |
Exception-Handling Overview | |
| |
| |
| |
Exception-Handling Example: Divide by Zero | |
| |
| |
| |
Java Exception Hierarchy | |
| |
| |
| |
Rethrowing an Exception | |
| |
| |
| |
finally Clause | |
| |
| |
| |
Stack Unwinding | |
| |
| |
| |
printStackTrace, getStackTrace and getMessage | |
| |
| |
| |
Chained Exceptions | |
| |
| |
| |
Declaring New Exception Types | |
| |
| |
| |
Constructors and Exception Handling | |
| |
| |
| |
Multithreading | |
| |
| |
| |
Introduction | |
| |
| |
| |
Thread States: Life Cycle of a Thread | |
| |
| |
| |
Thread Priorities and Thread Scheduling | |
| |
| |
| |
Creating and Executing Threads | |
| |
| |
| |
Thread Synchronization | |
| |
| |
| |
Producer/Consumer Relationship without Synchronization | |
| |
| |
| |
Producer/Consumer Relationship with Synchronization | |
| |
| |
| |
Producer/Consumer Relationship: Circular Buffer | |
| |
| |
| |
Daemon Threads | |
| |
| |
| |
Runnable Interface | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Multithreading | |
| |
| |
| |
(Optional) Discovering Design Patterns: Concurrent Design Patterns | |
| |
| |
| |
Files and Streams | |
| |
| |
| |
Introduction | |
| |
| |
| |
Data Hierarchy | |
| |
| |
| |
Files and Streams | |
| |
| |
| |
Class File | |
| |
| |
| |
Creating a Sequential-Access File | |
| |
| |
| |
Reading Data from a Sequential-Access File | |
| |
| |
| |
Updating Sequential-Access Files | |
| |
| |
| |
Random-Access Files | |
| |
| |
| |
Creating a Random-Access File | |
| |
| |
| |
Writing Data Randomly to a Random-Access File | |
| |
| |
| |
Reading Data Sequentially from a Random-Access File | |
| |
| |
| |
Case Study: A Transaction-Processing Program | |
| |
| |
| |
New I/O APIs for the Java Platform | |
| |
| |
| |
Networking | |
| |
| |
| |
Introduction | |
| |
| |
| |
Manipulating URLs | |
| |
| |
| |
Reading a File on a Web Server | |
| |
| |
| |
Establishing a Simple Server Using Stream Sockets | |
| |
| |
| |
Establishing a Simple Client Using Stream Sockets | |
| |
| |
| |
Client/Server Interaction with Stream Socket Connections | |
| |
| |
| |
Connectionless Client/Server Interaction with Datagrams | |
| |
| |
| |
Client/Server Tic-Tac-Toe Using a Multithreaded Server | |
| |
| |
| |
Security and the Network | |
| |
| |
| |
DeitelMessenger Chat Server and Client | |
| |
| |
| |
NIO Networking Overview | |
| |
| |
| |
(Optional) Discovering Design Patterns: Design Patterns Used in Packages java.io and java.net | |
| |
| |
| |
Multimedia: Images, Animation and Audio | |
| |
| |
| |
Introduction | |
| |
| |
| |
Loading, Displaying and Scaling Images | |
| |
| |
| |
Animating a Series of Images | |
| |
| |
| |
Image Maps | |
| |
| |
| |
Loading and Playing Audio Clips | |
| |
| |
| |
Internet and World Wide Web Resources | |
| |
| |
| |
(Optional Case Study) Thinking About Objects: Animation and Sound in the View | |
| |
| |
| |
Data Structures | |
| |
| |
| |
Introduction | |
| |
| |
| |
Self-Referential Classes | |
| |
| |
| |
Dynamic Memory Allocation | |
| |
| |
| |
Linked Lists | |
| |
| |
| |
Stacks | |
| |
| |
| |
Queues | |
| |
| |
| |
Trees | |
| |
| |
| |
Java Utilities Package and Bit Manipulation | |
| |
| |
| |
Introduction | |
| |
| |
| |
Vector Class and Enumeration Interface | |
| |
| |
| |
Stack Class of Package java.util | |
| |
| |
| |
Hashtable Class | |
| |
| |
| |
Properties Class | |
| |
| |
| |
Bit Manipulation and the Bitwise Operators | |
| |
| |
| |
BitSet Class | |
| |
| |
| |
Collections | |
| |
| |
| |
Introduction | |
| |
| |
| |
Collections Overview | |
| |
| |
| |
Class Arrays | |
| |
| |
| |
Interface Collection and Class Collections | |
| |
| |
| |
Lists | |
| |
| |
| |
Algorithms | |
| |
| |
| |
Sets | |
| |
| |
| |
Maps | |
| |
| |
| |
Synchronization Wrappers | |
| |
| |
| |
Unmodifiable Wrappers | |
| |
| |
| |
Abstract Implementations | |
| |
| |
| |
(Optional) Discovering Design Patterns: Design Patterns Used in Package java.util | |
| |
| |
| |
Java Database Connectivity with JDBC | |
| |
| |
| |
Introduction | |
| |
| |
| |
Relational Databases | |
| |
| |
| |
Relational Database Overview: The books Database | |
| |
| |
| |
SQL | |
| |
| |
| |
Creating Database books in Cloudscape | |
| |
| |
| |
Manipulating Databases with JDBC | |
| |
| |
| |
Stored Procedures | |
| |
| |
| |
Internet and World Wide Web Resources | |
| |
| |
| |
Servlets | |
| |
| |
| |
Introduction | |
| |
| |
| |
Servlet Overview and Architecture | |
| |
| |
| |
Handling HTTP get Requests | |
| |
| |
| |
Handling HTTP get Requests Containing Data | |
| |
| |
| |
Handling HTTP post Requests | |
| |
| |
| |
Redirecting Requests to Other Resources | |
| |
| |
| |
Multi-Tier Applications: Using JDBC from a Servlet | |
| |
| |
| |
Internet and World Wide Web Resources | |
| |
| |
| |
JavaServer Pages (JSP) | |
| |
| |
| |
Introduction | |
| |
| |
| |
JavaServer Pages Overview | |
| |
| |
| |
First JavaServer Page Example | |
| |
| |
| |
Implicit Objects | |
| |
| |
| |
Scripting | |
| |
| |
| |
Standard Actions | |
| |
| |
| |
Directives | |
| |
| |
| |
Case Study: Guest Book | |
| |
| |
| |
Internet and World Wide Web Resources | |
| |
| |
| |
Operator Precedence Chart | |
| |
| |
| |
ASCII Character Set | |
| |
| |
| |
Number Systems | |
| |
| |
| |
Introduction | |
| |
| |
| |
Abbreviating Binary Numbers as Octal Numbers and Hexadecimal Numbers | |
| |
| |
| |
Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers | |
| |
| |
| |
Converting from Binary, Octal or Hexadecimal to Decimal | |
| |
| |
| |
Converting from Decimal to Binary, Octal or Hexadecimal | |
| |
| |
| |
Negative Binary Numbers: Two's Complement Notation | |
| |
| |
| |
Elevator Events and Listener Interfaces | |
| |
| |
| |
Introduction | |
| |
| |
| |
Events | |
| |
| |
| |
Listeners | |
| |
| |
| |
Artifacts Revisited | |
| |
| |
| |
Elevator Model | |
| |
| |
| |
Introduction | |
| |
| |
| |
Class ElevatorSimulation | |
| |
| |
| |
Classes Location and Floor | |
| |
| |
| |
Classes Door and ElevatorDoor | |
| |
| |
| |
Class Button | |
| |
| |
| |
Class ElevatorShaft | |
| |
| |
| |
Classes Light and Bell | |
| |
| |
| |
Class Elevator | |
| |
| |
| |
Class Person | |
| |
| |
| |
Artifacts Revisited | |
| |
| |
| |
Conclusion | |
| |
| |
| |
Elevator View (on CD) | |
| |
| |
| |
Introduction | |
| |
| |
| |
Class Objects | |
| |
| |
| |
Class Constants | |
| |
| |
| |
Class Constructor | |
| |
| |
| |
Event Handling | |
| |
| |
| |
Artifacts Revisited | |
| |
| |
| |
Conclusion | |
| |
| |
| |
Unicode | |
| |
| |
| |
Introduction | |
| |
| |
| |
Unicode Transformation Formats | |
| |
| |
| |
Characters and Glyphs | |
| |
| |
| |
Advantages/Disadvantages of Unicode | |
| |
| |
| |
Unicode Consortium's Web Site | |
| |
| |
| |
Using Unicode | |
| |
| |
| |
Character Ranges | |
| |
| |
Bibliography | |
| |
| |
Index | |