Preface |
|
xvii | |
How to Use This Book |
|
xxi | |
|
An Introduction to Hardware, Software, and the Internet |
|
|
1 | (10) |
|
|
2 | (3) |
|
|
|
|
|
|
|
Secondary Storage Devices |
|
|
|
|
|
|
|
|
|
Representation of Information in Computer Memory |
|
|
|
|
|
|
|
|
|
|
|
|
5 | (6) |
|
An Introduction to Software Development |
|
|
11 | (32) |
|
|
12 | (2) |
|
Compilers and Interpreters |
|
|
14 | (6) |
|
Software Components and Packages |
|
|
20 | (1) |
|
Lab: Three Ways to Say Hello |
|
|
21 | (6) |
|
Object-Oriented Programming |
|
|
27 | (3) |
|
Lab: More Ways to Say Hello |
|
|
30 | (7) |
|
|
37 | (6) |
|
|
38 | (5) |
|
|
43 | (32) |
|
|
44 | (1) |
|
Objects in a Program: An Example |
|
|
45 | (4) |
|
|
49 | (5) |
|
Fields, Constructors, and Methods |
|
|
54 | (5) |
|
Case Study and Lab: First Steps |
|
|
59 | (3) |
|
|
62 | (5) |
|
|
67 | (8) |
|
|
69 | (6) |
|
|
75 | (28) |
|
|
76 | (1) |
|
|
77 | (5) |
|
|
82 | (1) |
|
|
83 | (3) |
|
Case Study: Euclid's GCF Algorithm |
|
|
86 | (2) |
|
|
88 | (3) |
|
|
91 | (3) |
|
|
94 | (9) |
|
|
95 | (8) |
|
|
103 | (18) |
|
|
104 | (1) |
|
|
105 | (2) |
|
Reserved Words and Programmer-Defined Names |
|
|
107 | (3) |
|
|
110 | (4) |
|
Statements, Blocks, Indentation |
|
|
114 | (1) |
|
Lab: Correcting Syntax Errors |
|
|
115 | (2) |
|
|
117 | (4) |
|
|
118 | (3) |
|
Data Types, Variables, and Arithmetic |
|
|
121 | (32) |
|
|
122 | (2) |
|
Declaring Fields and Local Variables |
|
|
124 | (4) |
|
|
128 | (1) |
|
|
129 | (1) |
|
|
130 | (3) |
|
|
133 | (1) |
|
|
134 | (4) |
|
Compound Assignment and Increment Operators |
|
|
138 | (2) |
|
Converting Numbers and Objects into Strings |
|
|
140 | (3) |
|
|
143 | (2) |
|
|
145 | (8) |
|
|
146 | (7) |
|
Boolean Expressions and if-else Statements |
|
|
153 | (40) |
|
|
154 | (2) |
|
|
156 | (1) |
|
|
157 | (1) |
|
|
158 | (2) |
|
|
160 | (2) |
|
|
162 | (1) |
|
|
163 | (1) |
|
if-else-if and Nested if-else |
|
|
164 | (5) |
|
Case Study and Lab: Rolling Dice |
|
|
169 | (9) |
|
|
178 | (2) |
|
|
180 | (3) |
|
Case Study and Lab: Rolling Dice Concluded |
|
|
183 | (3) |
|
|
186 | (7) |
|
|
188 | (5) |
|
Iterative Statements: while, for, do-while |
|
|
193 | (18) |
|
|
194 | (1) |
|
|
194 | (4) |
|
|
198 | (1) |
|
return and break in Loops |
|
|
199 | (2) |
|
|
201 | (3) |
|
|
204 | (1) |
|
|
205 | (6) |
|
|
206 | (5) |
|
Implementing Classes and Using Objects |
|
|
211 | (48) |
|
|
212 | (4) |
|
Public and Private Features of a Class |
|
|
216 | (2) |
|
|
218 | (4) |
|
|
222 | (1) |
|
|
223 | (3) |
|
Calling Methods and Accessing Fields |
|
|
226 | (3) |
|
Passing Parameters to Constructors and Methods |
|
|
229 | (3) |
|
|
232 | (3) |
|
Case Study and Lab: Snack Bar |
|
|
235 | (5) |
|
|
240 | (3) |
|
Static Fields and Methods |
|
|
243 | (5) |
|
Case Study and Lab: Snack Bar Concluded |
|
|
248 | (1) |
|
|
249 | (10) |
|
|
251 | (8) |
|
|
259 | (28) |
|
|
260 | (1) |
|
|
260 | (1) |
|
String Constructors and Immutability |
|
|
261 | (3) |
|
|
264 | (7) |
|
Formatting Numbers into Strings |
|
|
271 | (3) |
|
Extracting Numbers from Strings |
|
|
274 | (1) |
|
|
275 | (1) |
|
|
276 | (2) |
|
|
278 | (2) |
|
|
280 | (7) |
|
|
281 | (6) |
|
Class Hierarchies and Interfaces |
|
|
287 | (34) |
|
|
288 | (1) |
|
Class Hierarchies and Polymorphism |
|
|
289 | (5) |
|
|
294 | (4) |
|
Invoking Superclass's Constructors |
|
|
298 | (2) |
|
Calling Superclass's Methods |
|
|
300 | (2) |
|
|
302 | (4) |
|
|
306 | (4) |
|
Case Study: Dance Studio Concluded |
|
|
310 | (4) |
|
|
314 | (7) |
|
|
317 | (4) |
|
|
321 | (42) |
|
|
322 | (1) |
|
|
323 | (4) |
|
|
327 | (1) |
|
|
327 | (4) |
|
ArrayList's Constructors and Methods |
|
|
331 | (2) |
|
|
333 | (3) |
|
Iterations and the ``For Each'' Loop |
|
|
336 | (3) |
|
Inserting and Removing Elements |
|
|
339 | (1) |
|
Lab: Creating an Index for a Document |
|
|
340 | (4) |
|
|
344 | (2) |
|
Case Study and Lab: Chomp |
|
|
346 | (6) |
|
|
352 | (11) |
|
|
354 | (9) |
|
|
363 | (30) |
|
|
364 | (1) |
|
equals, compareTo, and compare |
|
|
365 | (6) |
|
Sequential and Binary Search |
|
|
371 | (4) |
|
Lab: Keeping Things in Order |
|
|
375 | (1) |
|
|
376 | (1) |
|
|
377 | (2) |
|
|
379 | (3) |
|
|
382 | (2) |
|
|
384 | (2) |
|
java.util.Arrays and java.util.Collections |
|
|
386 | (2) |
|
|
388 | (5) |
|
|
390 | (3) |
|
|
393 | (16) |
|
|
394 | (2) |
|
Pathnames and the java.io.File Class |
|
|
396 | (2) |
|
|
398 | (3) |
|
|
401 | (2) |
|
|
403 | (1) |
|
|
404 | (5) |
|
|
405 | (4) |
|
|
409 | (24) |
|
|
410 | (2) |
|
paint, paintComponent, and repaint |
|
|
412 | (3) |
|
|
415 | (3) |
|
|
418 | (1) |
|
|
419 | (2) |
|
|
421 | (1) |
|
Case Study and Lab: Pieces of the Puzzle |
|
|
422 | (7) |
|
|
429 | (4) |
|
|
430 | (3) |
|
GUI Components and Events |
|
|
433 | (8) |
|
|
434 | (2) |
|
|
|
Basic Swing Components and Their Events |
|
|
|
|
|
|
|
Case Study and Lab: the Ramblecs Game |
|
|
|
|
|
|
436 | (5) |
|
Mouse, Keyboard, Sounds, and Images |
|
|
441 | (4) |
|
|
442 | (1) |
|
|
|
|
|
Case Study and Lab: Drawing Editor |
|
|
|
|
|
Case Study and Lab: Ramblecs Concluded |
|
|
|
|
|
|
443 | (2) |
|
Big-O Analysis of Algorithms |
|
|
445 | (20) |
|
|
446 | (1) |
|
|
447 | (8) |
|
Big-O of Sorting Algorithms |
|
|
455 | (4) |
|
|
459 | (6) |
|
|
461 | (4) |
|
The Java Collections Framework |
|
|
465 | (42) |
|
|
466 | (2) |
|
|
468 | (4) |
|
|
472 | (6) |
|
|
478 | (2) |
|
|
480 | (2) |
|
|
482 | (2) |
|
|
484 | (3) |
|
|
487 | (5) |
|
Case Study and Lab: Stock Exchange |
|
|
492 | (7) |
|
|
499 | (8) |
|
|
499 | (8) |
|
|
507 | (20) |
|
|
508 | (1) |
|
|
508 | (6) |
|
|
514 | (2) |
|
Lab: Implementing a Singly-Linked List |
|
|
516 | (1) |
|
|
517 | (1) |
|
Doubly-Linked List and Circular List |
|
|
518 | (3) |
|
|
521 | (1) |
|
|
522 | (5) |
|
|
523 | (4) |
|
|
527 | (20) |
|
|
528 | (1) |
|
Implementations of Stacks |
|
|
528 | (3) |
|
|
531 | (2) |
|
|
533 | (2) |
|
Implementations of Queues |
|
|
535 | (1) |
|
Case Study and Lab: Actors World |
|
|
536 | (5) |
|
|
541 | (6) |
|
|
542 | (5) |
|
|
547 | (28) |
|
|
548 | (1) |
|
|
548 | (8) |
|
When Not to Use Recursion |
|
|
556 | (3) |
|
Understanding and Debugging Recursive Methods |
|
|
559 | (3) |
|
|
562 | (1) |
|
Case Study and Lab: the Game of Hex |
|
|
563 | (5) |
|
|
568 | (7) |
|
|
568 | (7) |
|
|
575 | (28) |
|
|
576 | (5) |
|
Implementations of Binary Trees |
|
|
581 | (2) |
|
|
583 | (1) |
|
|
584 | (2) |
|
|
586 | (5) |
|
|
591 | (1) |
|
Case Study and Lab: Java Messenger |
|
|
592 | (2) |
|
|
594 | (9) |
|
|
595 | (8) |
|
Lookup Tables and Hashing |
|
|
603 | (20) |
|
|
604 | (1) |
|
|
604 | (3) |
|
|
607 | (3) |
|
|
610 | (3) |
|
java.util's HashSet and HashMap |
|
|
613 | (2) |
|
|
615 | (2) |
|
|
617 | (6) |
|
|
618 | (5) |
|
Heaps and Priority Queues |
|
|
623 | (14) |
|
|
624 | (1) |
|
Implementations of Priority Queues |
|
|
624 | (2) |
|
Binary Trees: Non-Linked Representation |
|
|
626 | (2) |
|
A Do-It-Yourself Priority Queue |
|
|
628 | (4) |
|
|
632 | (1) |
|
|
633 | (4) |
|
|
634 | (3) |
|
|
637 | (8) |
|
|
638 | (2) |
|
|
|
|
|
|
|
|
|
|
|
MVC (Model-View-Controller) |
|
|
|
|
|
|
640 | (5) |
|
|
645 | (1) |
|
|
|
Common Syntax Error Messages |
|
|
|
|
|
|
|
The EasyReader, EasyWriter, EasySound, EasyDate, and EasyFormat Classes |
|
|
|
Computing in Context: Responsible and Ethical Computer Use |
|
|
Solutions to Selected Exercises |
|
645 | (2) |
Index of Tables and Figures |
|
647 | (6) |
Index |
|
653 | |