Attention! Your ePaper is waiting for publication!
By publishing your document, the content will be optimally indexed by Google via AI and sorted into the right category for over 500 million ePaper readers on YUMPU.
This will ensure high visibility and many readers!
Your ePaper is now published and live on YUMPU!
You can find your publication here:
Share your interactive ePaper on all platforms and on your website with our embed function
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
This page intentionally left blank
This page intentionally left blank
- Page 2:
ONLINE ACCESS Thank you for purchas
- Page 6:
This page intentionally left blank
- Page 10:
Editorial Director: Marcia Horton E
- Page 14:
This page intentionally left blank
- Page 18:
viii Preface complete revision new
- Page 22:
x Preface Organization of the Book
- Page 26:
xii Preface ■ ■ Instructors can
- Page 30:
xiv Preface Tront (Simon Fraser Uni
- Page 34:
CONTENTS Chapter 1 Introduction to
- Page 38:
xviii Contents 5.6 Modularizing Cod
- Page 42:
xx Contents 11.11 The ArrayList Cla
- Page 46:
xxii Contents 17.7 Sliders 657 17.8
- Page 50:
VideoNote VideoNotes Locations of V
- Page 54:
xxvi VideoNotes Chapter 19 Chapter
- Page 58:
2 Chapter 1 Introduction to Compute
- Page 62:
4 Chapter 1 Introduction to Compute
- Page 66:
6 Chapter 1 Introduction to Compute
- Page 70:
8 Chapter 1 Introduction to Compute
- Page 74:
10 Chapter 1 Introduction to Comput
- Page 78:
12 Chapter 1 Introduction to Comput
- Page 82:
14 Chapter 1 Introduction to Comput
- Page 86:
16 Chapter 1 Introduction to Comput
- Page 90:
18 Chapter 1 Introduction to Comput
- Page 94:
20 Chapter 1 Introduction to Comput
- Page 98:
22 Chapter 1 Introduction to Comput
- Page 102:
24 Chapter 1 Introduction to Comput
- Page 106:
26 Chapter 1 Introduction to Comput
- Page 110:
28 Chapter 1 Introduction to Comput
- Page 114:
30 Chapter 1 Introduction to Comput
- Page 118:
32 Chapter 1 Introduction to Comput
- Page 122:
34 Chapter 2 Elementary Programming
- Page 126:
36 Chapter 2 Elementary Programming
- Page 130:
38 Chapter 2 Elementary Programming
- Page 134:
40 Chapter 2 Elementary Programming
- Page 138:
42 Chapter 2 Elementary Programming
- Page 142:
44 Chapter 2 Elementary Programming
- Page 146:
46 Chapter 2 Elementary Programming
- Page 150:
48 Chapter 2 Elementary Programming
- Page 154:
50 Chapter 2 Elementary Programming
- Page 158:
52 Chapter 2 Elementary Programming
- Page 162:
54 Chapter 2 Elementary Programming
- Page 166:
56 Chapter 2 Elementary Programming
- Page 170:
58 Chapter 2 Elementary Programming
- Page 174:
60 Chapter 2 Elementary Programming
- Page 178:
62 Chapter 2 Elementary Programming
- Page 182:
64 Chapter 2 Elementary Programming
- Page 186:
66 Chapter 2 Elementary Programming
- Page 190:
68 Chapter 2 Elementary Programming
- Page 194:
70 Chapter 2 Elementary Programming
- Page 198:
72 Chapter 2 Elementary Programming
- Page 202:
74 Chapter 2 Elementary Programming
- Page 206:
76 Chapter 2 Elementary Programming
- Page 210:
78 Chapter 2 Elementary Programming
- Page 214:
80 Chapter 2 Elementary Programming
- Page 218:
82 Chapter 3 Selections problem sel
- Page 222:
84 Chapter 3 Selections ✓Point✓
- Page 226:
86 Chapter 3 Selections Enter an in
- Page 230:
88 Chapter 3 Selections in Set4? in
- Page 234:
90 Chapter 3 Selections Here is the
- Page 238:
92 Chapter 3 Selections score >= 90
- Page 242:
94 Chapter 3 Selections Common Erro
- Page 246:
96 Chapter 3 Selections VideoNote P
- Page 250:
98 Chapter 3 Selections LISTING 3.5
- Page 254:
100 Chapter 3 Selections input stat
- Page 258:
102 Chapter 3 Selections to create
- Page 262:
104 Chapter 3 Selections incompatib
- Page 266:
106 Chapter 3 Selections input leap
- Page 270:
108 Chapter 3 Selections Key Point
- Page 274:
110 Chapter 3 Selections Now let us
- Page 278:
112 Chapter 3 Selections The result
- Page 282:
114 Chapter 3 Selections Here is an
- Page 286:
116 Chapter 3 Selections operator p
- Page 290:
118 Chapter 3 Selections set3 set4
- Page 294:
120 Chapter 3 Selections ■ Settin
- Page 298:
122 Chapter 3 Selections Note that
- Page 302:
124 Chapter 3 Selections example, i
- Page 306:
126 Chapter 3 Selections y-axis (9,
- Page 310:
128 Chapter 3 Selections Enter a po
- Page 314:
130 Chapter 3 Selections Enter the
- Page 318:
This page intentionally left blank
- Page 322:
134 Chapter 4 Loops problem Key Poi
- Page 326:
136 Chapter 4 Loops This loop is in
- Page 330:
138 Chapter 4 Loops too low? 20 Sys
- Page 334:
140 Chapter 4 Loops get start time
- Page 338:
142 Chapter 4 Loops loop end of loo
- Page 342:
144 Chapter 4 Loops 4.4 Suppose the
- Page 346:
146 Chapter 4 Loops ✓Point✓ Che
- Page 350:
148 Chapter 4 Loops initial-action
- Page 354:
150 Chapter 4 Loops pretest loop po
- Page 358:
152 Chapter 4 Loops nested loop tab
- Page 362:
154 Chapter 4 Loops VideoNote Minim
- Page 366:
156 Chapter 4 Loops input input gcd
- Page 370:
158 Chapter 4 Loops 4.8.3 Case Stud
- Page 374:
160 Chapter 4 Loops continue LISTIN
- Page 378:
162 Chapter 4 Loops 4.24 Rewrite th
- Page 382:
164 Chapter 4 Loops The first 50 pr
- Page 386:
166 Chapter 4 Loops CHAPTER SUMMARY
- Page 390:
168 Chapter 4 Loops 4.6 (Conversion
- Page 394:
170 Chapter 4 Loops VideoNote Displ
- Page 398:
172 Chapter 4 Loops *4.30 (Financia
- Page 402:
174 Chapter 4 Loops *4.42 (Financia
- Page 406:
This page intentionally left blank
- Page 410:
178 Chapter 5 Methods problem why m
- Page 414:
180 Chapter 5 Methods define vs. de
- Page 418:
182 Chapter 5 Methods public static
- Page 422:
184 Chapter 5 Methods getGrade meth
- Page 426:
186 Chapter 5 Methods Key Point par
- Page 430:
188 Chapter 5 Methods The values of
- Page 434:
190 Chapter 5 Methods invoke gcd co
- Page 438:
192 Chapter 5 Methods For example,
- Page 442:
194 Chapter 5 Methods method overlo
- Page 446:
196 Chapter 5 Methods } public stat
- Page 450:
198 Chapter 5 Methods /** Convert t
- Page 454:
200 Chapter 5 Methods Math.abs(-2)
- Page 458:
202 Chapter 5 Methods Hence, a rand
- Page 462:
204 Chapter 5 Methods Enter full ye
- Page 466:
206 Chapter 5 Methods printCalendar
- Page 470:
208 Chapter 5 Methods printMonth pr
- Page 474:
210 Chapter 5 Methods isLeapYear 11
- Page 478:
212 Chapter 5 Methods PROGRAMMING E
- Page 482:
214 Chapter 5 Methods /** Convert f
- Page 486:
216 Chapter 5 Methods 5.18 (Use the
- Page 490:
218 Chapter 5 Methods Comprehensive
- Page 494:
220 Chapter 5 Methods 5. If the res
- Page 498:
222 Chapter 5 Methods Write a test
- Page 502:
224 Chapter 6 Single-Dimensional Ar
- Page 506:
226 Chapter 6 Single-Dimensional Ar
- Page 510:
228 Chapter 6 Single-Dimensional Ar
- Page 514:
230 Chapter 6 Single-Dimensional Ar
- Page 518:
232 Chapter 6 Single-Dimensional Ar
- Page 522:
234 Chapter 6 Single-Dimensional Ar
- Page 526:
236 Chapter 6 Single-Dimensional Ar
- Page 530:
238 Chapter 6 Single-Dimensional Ar
- Page 534:
240 Chapter 6 Single-Dimensional Ar
- Page 538:
242 Chapter 6 Single-Dimensional Ar
- Page 542:
244 Chapter 6 Single-Dimensional Ar
- Page 546:
246 Chapter 6 Single-Dimensional Ar
- Page 550:
248 Chapter 6 Single-Dimensional Ar
- Page 554:
250 Chapter 6 Single-Dimensional Ar
- Page 558:
252 Chapter 6 Single-Dimensional Ar
- Page 562:
254 Chapter 6 Single-Dimensional Ar
- Page 566:
256 Chapter 6 Single-Dimensional Ar
- Page 570:
258 Chapter 6 Single-Dimensional Ar
- Page 574:
260 Chapter 6 Single-Dimensional Ar
- Page 578:
262 Chapter 6 Single-Dimensional Ar
- Page 582:
264 Chapter 7 Multidimensional Arra
- Page 586:
266 Chapter 7 Multidimensional Arra
- Page 590:
268 Chapter 7 Multidimensional Arra
- Page 594:
270 Chapter 7 Multidimensional Arra
- Page 598:
272 Chapter 7 Multidimensional Arra
- Page 602:
274 Chapter 7 Multidimensional Arra
- Page 606:
276 Chapter 7 Multidimensional Arra
- Page 610:
278 Chapter 7 Multidimensional Arra
- Page 614:
280 Chapter 7 Multidimensional Arra
- Page 618:
282 Chapter 7 Multidimensional Arra
- Page 622:
284 Chapter 7 Multidimensional Arra
- Page 626:
286 Chapter 7 Multidimensional Arra
- Page 630:
288 Chapter 7 Multidimensional Arra
- Page 634:
290 Chapter 7 Multidimensional Arra
- Page 638:
292 Chapter 7 Multidimensional Arra
- Page 642:
294 Chapter 7 Multidimensional Arra
- Page 646:
296 Chapter 8 Objects and Classes w
- Page 650:
298 Chapter 8 Objects and Classes U
- Page 654:
300 Chapter 8 Objects and Classes T
- Page 658:
302 Chapter 8 Objects and Classes s
- Page 662:
304 Chapter 8 Objects and Classes K
- Page 666:
306 Chapter 8 Objects and Classes }
- Page 670:
308 Chapter 8 Objects and Classes 1
- Page 674:
310 Chapter 8 Objects and Classes W
- Page 678:
312 Chapter 8 Objects and Classes c
- Page 682:
314 Chapter 8 Objects and Classes 2
- Page 686:
316 Chapter 8 Objects and Classes N
- Page 690:
318 Chapter 8 Objects and Classes u
- Page 694:
320 Chapter 8 Objects and Classes A
- Page 698:
322 Chapter 8 Objects and Classes S
- Page 702:
324 Chapter 8 Objects and Classes S
- Page 706:
326 Chapter 8 Objects and Classes 8
- Page 710:
328 Chapter 8 Objects and Classes 8
- Page 714:
330 Chapter 8 Objects and Classes T
- Page 718:
332 Chapter 8 Objects and Classes
- Page 722:
334 Chapter 8 Objects and Classes T
- Page 726:
336 Chapter 9 Strings Key Point Key
- Page 730:
338 Chapter 9 Strings java.lang.Str
- Page 734:
340 Chapter 9 Strings string index
- Page 738:
342 Chapter 9 Strings why regular e
- Page 742:
344 Chapter 9 Strings To convert an
- Page 746:
346 Chapter 9 Strings 9.5 Let s1 be
- Page 750:
348 Chapter 9 Strings low index hig
- Page 754:
350 Chapter 9 Strings hex char to d
- Page 758:
352 Chapter 9 Strings input string
- Page 762:
354 Chapter 9 Strings java.lang.Str
- Page 766:
356 Chapter 9 Strings the builder
- Page 770:
358 Chapter 9 Strings 9.20 Suppose
- Page 774:
360 Chapter 9 Strings Add Subtract
- Page 778:
362 Chapter 9 Strings 4. You can us
- Page 782:
364 Chapter 9 Strings Enter a strin
- Page 786:
366 Chapter 9 Strings **9.18 (Imple
- Page 790:
368 Chapter 9 Strings Enter a genom
- Page 794:
370 Chapter 10 Thinking in Objects
- Page 798:
372 Chapter 10 Thinking in Objects
- Page 802:
374 Chapter 10 Thinking in Objects
- Page 806:
376 Chapter 10 Thinking in Objects
- Page 810:
378 Chapter 10 Thinking in Objects
- Page 814:
380 Chapter 10 Thinking in Objects
- Page 818:
382 Chapter 10 Thinking in Objects
- Page 822:
384 Chapter 10 Thinking in Objects
- Page 826:
386 Chapter 10 Thinking in Objects
- Page 830:
388 Chapter 10 Thinking in Objects
- Page 834:
390 Chapter 10 Thinking in Objects
- Page 838:
392 Chapter 10 Thinking in Objects
- Page 842:
394 Chapter 10 Thinking in Objects
- Page 846:
396 Chapter 10 Thinking in Objects
- Page 850:
398 Chapter 10 Thinking in Objects
- Page 854:
400 Chapter 10 Thinking in Objects
- Page 858:
402 Chapter 10 Thinking in Objects
- Page 862:
404 Chapter 10 Thinking in Objects
- Page 866:
406 Chapter 10 Thinking in Objects
- Page 870:
408 Chapter 11 Inheritance and Poly
- Page 874:
410 Chapter 11 Inheritance and Poly
- Page 878:
412 Chapter 11 Inheritance and Poly
- Page 882:
414 Chapter 11 Inheritance and Poly
- Page 886:
416 Chapter 11 Inheritance and Poly
- Page 890:
418 Chapter 11 Inheritance and Poly
- Page 894:
420 Chapter 11 Inheritance and Poly
- Page 898:
422 Chapter 11 Inheritance and Poly
- Page 902:
424 Chapter 11 Inheritance and Poly
- Page 906:
426 Chapter 11 Inheritance and Poly
- Page 910:
428 Chapter 11 Inheritance and Poly
- Page 914:
430 Chapter 11 Inheritance and Poly
- Page 918:
432 Chapter 11 Inheritance and Poly
- Page 922:
434 Chapter 11 Inheritance and Poly
- Page 926:
436 Chapter 11 Inheritance and Poly
- Page 930:
438 Chapter 11 Inheritance and Poly
- Page 934:
440 Chapter 11 Inheritance and Poly
- Page 938:
442 Chapter 11 Inheritance and Poly
- Page 942:
444 Chapter 11 Inheritance and Poly
- Page 946:
446 Chapter 12 GUI Basics AWT Swing
- Page 950:
448 Chapter 12 GUI Basics TABLE 12.
- Page 954:
450 Chapter 12 GUI Basics Title bar
- Page 958:
452 Chapter 12 GUI Basics VideoNote
- Page 962:
454 Chapter 12 GUI Basics This code
- Page 966:
456 Chapter 12 GUI Basics because t
- Page 970:
458 Chapter 12 GUI Basics can then
- Page 974:
460 Chapter 12 GUI Basics 31 /** Ma
- Page 978:
462 Chapter 12 GUI Basics VideoNote
- Page 982:
464 Chapter 12 GUI Basics set foreg
- Page 986:
466 Chapter 12 GUI Basics An image
- Page 990:
468 Chapter 12 GUI Basics Component
- Page 994:
470 Chapter 12 GUI Basics horizonta
- Page 998:
472 Chapter 12 GUI Basics Here is a
- Page 1002:
474 Chapter 12 GUI Basics // Create
- Page 1006:
476 Chapter 12 GUI Basics 10. You c
- Page 1010:
478 Chapter 12 GUI Basics VideoNote
- Page 1014:
480 Chapter 13 Graphics Problem Key
- Page 1018:
482 Chapter 13 Graphics create a pa
- Page 1022:
484 Chapter 13 Graphics (x, y) (x,
- Page 1026:
486 Chapter 13 Graphics 19 frame.se
- Page 1030:
488 Chapter 13 Graphics The repaint
- Page 1034:
490 Chapter 13 Graphics negative de
- Page 1038:
492 Chapter 13 Graphics 2 6 (x, y)
- Page 1042:
494 Chapter 13 Graphics This method
- Page 1046:
496 Chapter 13 Graphics add message
- Page 1050:
498 Chapter 13 Graphics repaint pan
- Page 1054:
500 Chapter 13 Graphics 1 public cl
- Page 1058:
502 Chapter 13 Graphics The positio
- Page 1062:
504 Chapter 13 Graphics get current
- Page 1066:
506 Chapter 13 Graphics Key Point 1
- Page 1070:
508 Chapter 13 Graphics 37 38 /** R
- Page 1074:
510 Chapter 13 Graphics (a) (b) (c)
- Page 1078:
512 Chapter 13 Graphics Hint: The U
- Page 1082:
514 Chapter 13 Graphics 13.23 (Disp
- Page 1086:
516 Chapter 13 Graphics *13.32 (Geo
- Page 1090:
518 Chapter 14 Exception Handling a
- Page 1094:
520 Chapter 14 Exception Handling a
- Page 1098:
522 Chapter 14 Exception Handling a
- Page 1102:
524 Chapter 14 Exception Handling a
- Page 1106:
526 Chapter 14 Exception Handling a
- Page 1110:
528 Chapter 14 Exception Handling a
- Page 1114:
530 Chapter 14 Exception Handling a
- Page 1118:
532 Chapter 14 Exception Handling a
- Page 1122:
534 Chapter 14 Exception Handling a
- Page 1126:
536 Chapter 14 Exception Handling a
- Page 1130:
538 Chapter 14 Exception Handling a
- Page 1134:
540 Chapter 14 Exception Handling a
- Page 1138:
542 Chapter 14 Exception Handling a
- Page 1142:
544 Chapter 14 Exception Handling a
- Page 1146:
546 Chapter 14 Exception Handling a
- Page 1150:
548 Chapter 14 Exception Handling a
- Page 1154:
550 Chapter 14 Exception Handling a
- Page 1158:
552 Chapter 14 Exception Handling a
- Page 1162:
554 Chapter 14 Exception Handling a
- Page 1166:
556 Chapter 14 Exception Handling a
- Page 1170:
558 Chapter 14 Exception Handling a
- Page 1174:
560 Chapter 15 Abstract Classes and
- Page 1178:
562 Chapter 15 Abstract Classes and
- Page 1182:
564 Chapter 15 Abstract Classes and
- Page 1186:
566 Chapter 15 Abstract Classes and
- Page 1190:
568 Chapter 15 Abstract Classes and
- Page 1194:
570 Chapter 15 Abstract Classes and
- Page 1198:
572 Chapter 15 Abstract Classes and
- Page 1202:
574 Chapter 15 Abstract Classes and
- Page 1206:
576 Chapter 15 Abstract Classes and
- Page 1210:
578 Chapter 15 Abstract Classes and
- Page 1214:
580 Chapter 15 Abstract Classes and
- Page 1218:
582 Chapter 15 Abstract Classes and
- Page 1222:
584 Chapter 15 Abstract Classes and
- Page 1226:
586 Chapter 15 Abstract Classes and
- Page 1230:
588 Chapter 15 Abstract Classes and
- Page 1234:
590 Chapter 15 Abstract Classes and
- Page 1238:
592 Chapter 15 Abstract Classes and
- Page 1242:
594 Chapter 15 Abstract Classes and
- Page 1246:
596 Chapter 15 Abstract Classes and
- Page 1250:
This page intentionally left blank
- Page 1254:
600 Chapter 16 Event-Driven Program
- Page 1258:
602 Chapter 16 Event-Driven Program
- Page 1262:
604 Chapter 16 Event-Driven Program
- Page 1266:
606 Chapter 16 Event-Driven Program
- Page 1270:
608 Chapter 16 Event-Driven Program
- Page 1274:
610 Chapter 16 Event-Driven Program
- Page 1278:
612 Chapter 16 Event-Driven Program
- Page 1282:
614 Chapter 16 Event-Driven Program
- Page 1286:
616 Chapter 16 Event-Driven Program
- Page 1290:
618 Chapter 16 Event-Driven Program
- Page 1294:
620 Chapter 16 Event-Driven Program
- Page 1298:
622 Chapter 16 Event-Driven Program
- Page 1302:
624 Chapter 16 Event-Driven Program
- Page 1306:
626 Chapter 16 Event-Driven Program
- Page 1310:
628 Chapter 16 Event-Driven Program
- Page 1314:
630 Chapter 16 Event-Driven Program
- Page 1318:
632 Chapter 16 Event-Driven Program
- Page 1322:
634 Chapter 16 Event-Driven Program
- Page 1326:
636 Chapter 16 Event-Driven Program
- Page 1330:
638 Chapter 16 Event-Driven Program
- Page 1334:
640 Chapter 17 GUI Components Key P
- Page 1338:
642 Chapter 17 GUI Components regis
- Page 1342:
644 Chapter 17 GUI Components Key P
- Page 1346:
646 Chapter 17 GUI Components wrap
- Page 1350:
648 Chapter 17 GUI Components javax
- Page 1354:
650 Chapter 17 GUI Components liste
- Page 1358:
652 Chapter 17 GUI Components JList
- Page 1362:
654 Chapter 17 GUI Components By de
- Page 1366:
656 Chapter 17 GUI Components verti
- Page 1370:
658 Chapter 17 GUI Components javax
- Page 1374:
660 Chapter 17 GUI Components 64 do
- Page 1378:
662 Chapter 17 GUI Components creat
- Page 1382:
664 Chapter 17 GUI Components ✓Po
- Page 1386:
666 Chapter 17 GUI Components *17.6
- Page 1390:
668 Chapter 17 GUI Components Video
- Page 1394:
670 Chapter 17 GUI Components **17.
- Page 1398:
672 Chapter 18 Applets and Multimed
- Page 1402:
674 Chapter 18 Applets and Multimed
- Page 1406:
676 Chapter 18 Applets and Multimed
- Page 1410:
678 Chapter 18 Applets and Multimed
- Page 1414:
680 Chapter 18 Applets and Multimed
- Page 1418:
682 Chapter 18 Applets and Multimed
- Page 1422:
684 Chapter 18 Applets and Multimed
- Page 1426:
686 Chapter 18 Applets and Multimed
- Page 1430:
688 Chapter 18 Applets and Multimed
- Page 1434:
690 Chapter 18 Applets and Multimed
- Page 1438:
692 Chapter 18 Applets and Multimed
- Page 1442:
694 Chapter 18 Applets and Multimed
- Page 1446:
696 Chapter 18 Applets and Multimed
- Page 1450:
698 Chapter 18 Applets and Multimed
- Page 1454:
700 Chapter 18 Applets and Multimed
- Page 1458:
702 Chapter 18 Applets and Multimed
- Page 1462:
704 Chapter 18 Applets and Multimed
- Page 1466:
706 Chapter 18 Applets and Multimed
- Page 1470:
708 Chapter 18 Applets and Multimed
- Page 1474:
710 Chapter 19 Binary I/O text file
- Page 1478:
712 Chapter 19 Binary I/O hex) and
- Page 1482:
714 Chapter 19 Binary I/O java.io.I
- Page 1486:
716 Chapter 19 Binary I/O new Print
- Page 1490:
718 Chapter 19 Binary I/O The follo
- Page 1494:
720 Chapter 19 Binary I/O BufferedI
- Page 1498:
722 Chapter 19 Binary I/O public cl
- Page 1502:
724 Chapter 19 Binary I/O output st
- Page 1506:
726 Chapter 19 Binary I/O output 10
- Page 1510:
728 Chapter 19 Binary I/O number in
- Page 1514:
730 Chapter 19 Binary I/O «interfa
- Page 1518:
732 Chapter 19 Binary I/O A RandomA
- Page 1522:
734 Chapter 19 Binary I/O Section 1
- Page 1526:
736 Chapter 19 Binary I/O For a hin
- Page 1530:
738 Chapter 20 Recursion search wor
- Page 1534:
740 Chapter 20 Recursion factorial(
- Page 1538:
742 Chapter 20 Recursion The series
- Page 1542:
744 Chapter 20 Recursion Pedagogica
- Page 1546:
746 Chapter 20 Recursion 12 System.
- Page 1550:
748 Chapter 20 Recursion recursive
- Page 1554:
750 Chapter 20 Recursion getSize me
- Page 1558:
752 Chapter 20 Recursion n - 1 disk
- Page 1562:
754 Chapter 20 Recursion system use
- Page 1566:
756 Chapter 20 Recursion 20.20 ✓P
- Page 1570:
758 Chapter 20 Recursion performanc
- Page 1574:
760 Chapter 20 Recursion TEST QUEST
- Page 1578:
762 Chapter 20 Recursion *20.16 (Fi
- Page 1582:
764 Chapter 20 Recursion (a) Correc
- Page 1586:
766 Chapter 20 Recursion FIGURE 20.
- Page 1590:
This page intentionally left blank
- Page 1594:
This page intentionally left blank
- Page 1598:
APPENDIX B The ASCII Character Set
- Page 1602:
APPENDIX C Operator Precedence Char
- Page 1606:
APPENDIX D Java Modifiers Modifiers
- Page 1610:
APPENDIX E Special Floating-Point V
- Page 1614:
780 Appendix F binary to decimal F.
- Page 1618:
782 Appendix F TABLE F.1 Converting
- Page 1622:
This page intentionally left blank
- Page 1626: 786 Index add method, for adding co
- Page 1630: 788 Index Binary I/O (continued) cl
- Page 1634: 790 Index Combo boxes ComboBoxDemo.
- Page 1638: 792 Index Declaring static methods,
- Page 1642: 794 Index Fahrenheit, converting Ce
- Page 1646: 796 Index Hardware, 2 Has-a relatio
- Page 1650: 798 Index Interfaces (continued) So
- Page 1654: 800 Index Kilobytes (KBs), 5 Knight
- Page 1658: 802 Index Methods (continued) varia
- Page 1662: 804 Index Ovals, drawing, 483-484,
- Page 1666: 806 Index Read-only streams, 729. s
- Page 1670: 808 Index Static methods in CircleW
- Page 1674: 810 Index toString method (continue
- Page 1680: Java Quick Reference Frequently Use
- Page 1684: ***This is a bonus Web chapter CHAP
- Page 1688: java.util.Locale +Locale(language:
- Page 1692: 35.3.1 The TimeZone Class TimeZone
- Page 1696: DateFormatSymbols symbols = new Dat
- Page 1700: 37 (DateFormat.MEDIUM, DateFormat.L
- Page 1704: An instance of StillClock is create
- Page 1708: 13 14 private java.util.Calendar ca
- Page 1712: 129 showDays(); 130 } 131 132 /** R
- Page 1716: 50 if (e.getSource() == jcboLocale)
- Page 1720: You can control the display of numb
- Page 1724: 1 import java.awt.*; 2 import
- Page 1728:
109 public void actionPerformed(Act
- Page 1732:
The first method returns a Resource
- Page 1736:
Number_Formatting=demonstration du
- Page 1740:
99 jtfFormattedLoanAmount.setHorizo
- Page 1744:
Property resource bundles are imple
- Page 1748:
Chapter Summary 1. Java is the firs
- Page 1752:
(Display date and time) Write a pro
- Page 1756:
(Specify file encodings) Write a pr
- Page 1760:
36.1 Introduction Every Java user i
- Page 1764:
public void setMessage(String s) pu
- Page 1768:
Source Component Register listener
- Page 1772:
public void removeListener(Listener
- Page 1776:
63 } 64 } 65 66 /** Fire ActionEven
- Page 1780:
22 public void actionPerformed(Acti
- Page 1784:
4 } An event class is an extension
- Page 1788:
egistration and deregistration meth
- Page 1792:
Key Terms write the code to generat
- Page 1796:
Whenever the hurricane category is
- Page 1800:
java.util.EventObject java.util.Eve
- Page 1804:
37.1 Introduction Chapter 12, “
- Page 1808:
esizable is a boolean value indicat
- Page 1812:
from the origin, 0.5 is centered, a
- Page 1816:
1 import java.awt.*; 2 impor
- Page 1820:
BoxLayout boxLayout = new BoxLayout
- Page 1824:
20 private ImageIcon imageIconGerma
- Page 1828:
1. Use this statement to specify a
- Page 1832:
public void removeLayoutComponent(C
- Page 1836:
25 26 public Dimension preferredLay
- Page 1840:
17 new JRadioButton("FlowLayout");
- Page 1844:
javax.swing.JComponent javax.swing.
- Page 1848:
18 JComboBox jcboMap = new JComboBo
- Page 1852:
given title and/or icon. Figure 37.
- Page 1856:
javax.swing.JComponent javax.swing.
- Page 1860:
50 jpComponents.add(new JButton("Bu
- Page 1864:
[BL]EtchedBorder is an etched borde
- Page 1868:
Listing 37.9 gives an example that
- Page 1872:
43 jpPosition.add(jrbBelowTop = new
- Page 1876:
161 border = new MatteBorder(15, 15
- Page 1880:
Do the test questions for this chap
- Page 1884:
37.4* (Use CardLayout) Write an app
- Page 1888:
***This is a bonus Web chapter CHAP
- Page 1892:
(a) (b) (c) Figure 38.1 (a) The men
- Page 1896:
The new icons and mnemonics are sho
- Page 1900:
32 // Add menu items with mnemonics
- Page 1904:
The private method calculate(char o
- Page 1908:
25 add(new JScrollPane(jTextArea1),
- Page 1912:
Figure 38.5 The toolbar contains th
- Page 1916:
«interface» java.awt.event.Action
- Page 1920:
12 "/image/leftAlignment.png")); 13
- Page 1924:
(a) (b) Figure 38.10 (a) A JOptionP
- Page 1928:
The parameters parentComponent, mes
- Page 1932:
38.6.5 Example: Creating JOptionPan
- Page 1936:
70 JOptionPane.showMessageDialog(nu
- Page 1940:
47 jpSliders.add(jslGreen); 48 jpSl
- Page 1944:
dialog is set modal in line 24 in C
- Page 1948:
desired, but often you create an in
- Page 1952:
42 // Add menu items to the menu 43
- Page 1956:
174 175 // Display the status of th
- Page 1960:
38.4 How do you set an icon and a t
- Page 1964:
38.4* (Use actions) Write a program
- Page 1968:
Figure 38.29 The new TicTacToe game
- Page 1972:
39.1 Introduction The Swing user in
- Page 1976:
1 import java.awt.event.*; 2 im
- Page 1980:
6 7 /** Set a model */ 8 public voi
- Page 1984:
2 import java.awt.event.*; 3 import
- Page 1988:
Another variation of the model-view
- Page 1992:
JSpinner, JList, JComboBox, JTable,
- Page 1996:
18 spinner.addChangeListener(new Ch
- Page 2000:
maximum properties can be null to i
- Page 2004:
The JSpinner's constructor creates
- Page 2008:
88 numberModel.setMaximum(new Integ
- Page 2012:
39.7.1 JList Constructors, Properti
- Page 2016:
model, because the DefaultListSelec
- Page 2020:
80 Object[] values = jlst.getSelect
- Page 2024:
AbstractListModel implements the Li
- Page 2028:
The new item is inserted before the
- Page 2032:
15 boolean cellHasFocus) { 16 Objec
- Page 2036:
35 bigIcons[i] = new ImageIcon(getC
- Page 2040:
ListModel ComboBoxModel AbstractLis
- Page 2044:
34 } 35 36 // Set list cell rendere
- Page 2048:
39.2 How do you do implement models
- Page 2052:
SpinnerModelEditorDemo.java. Improv
- Page 2056:
(a) The list displays geometrical s
- Page 2060:
40.1 Introduction The preceding cha
- Page 2064:
an array, or row data and column he
- Page 2068:
20 }; 21 22 // Create a table 23 pr
- Page 2072:
AbstractTableModel and implement at
- Page 2076:
TableModel and DefaultTableModel co
- Page 2080:
14 15 // Create a table 16 private
- Page 2084:
1 import javax.swing.*; 2 import
- Page 2088:
(a) (b) Figure 40.14 You can add a
- Page 2092:
75 JPanel panel5 = new JPanel(); 76
- Page 2096:
207 } 208 209 private Vector getCol
- Page 2100:
Listing 40.7 gives a custom table m
- Page 2104:
This method signature is very simil
- Page 2108:
} } This example uses the same tabl
- Page 2112:
54 private JTextArea jtaMessage = n
- Page 2116:
Figure 40.18 JTree displays data in
- Page 2120:
javax.swing.JTree #cellEditor: Tree
- Page 2124:
29 private JComboBox jcboShowsRootH
- Page 2128:
«interface» javax.swing.tree.Tree
- Page 2132:
«interface» javax.swing.tree.Tree
- Page 2136:
14 europe.add(new DefaultMutableTre
- Page 2140:
«interface» javax.swing.tree.Tree
- Page 2144:
27 jtaOutput.append("\nProcessing a
- Page 2148:
13 private JCheckBox jchkEditable =
- Page 2152:
145 ((DefaultTreeModel)(jTree2.getM
- Page 2156:
40.15 Tree Events JTree can fire Tr
- Page 2160:
enables the user to enter or choose
- Page 2164:
Sections 40.8-40.14 40.6* (Create a
- Page 2168:
***This is a bonus Web chapter CHAP
- Page 2172:
import java.awt.*; import java.awt
- Page 2176:
} jbtClearSQLCommand.addActionListe
- Page 2180:
method is invoked (lines 208-221).
- Page 2184:
"jdbc:oracle:thin:@liang.armstrong.
- Page 2188:
input = new Scanner(new File(filena
- Page 2192:
CONCUR_UPDATABLE: The result set ca
- Page 2196:
} } } Driver loaded Database conne
- Page 2200:
«interface» java.sql.ResultSet «
- Page 2204:
import java.sql.*; import javax.sql
- Page 2208:
} } System.out.println("After updat
- Page 2212:
int column). The AbstractTableModel
- Page 2216:
} } System.out.println("Cursor move
- Page 2220:
jPanel1.add(jcboURL); jPanel1.add(j
- Page 2224:
} /** Create a TableEditor */ publi
- Page 2228:
int selectedRow = jTable1.getSelect
- Page 2232:
import java.sql.*; impo
- Page 2236:
} } private void retrieveFlagInfo(S
- Page 2240:
Use the Math.random() method to gen
- Page 2244:
The Country table is displayed in a
- Page 2248:
42.1 Introduction Servlets are Jav
- Page 2252:
The two most common HTTP requests,
- Page 2256:
} } HttpServletResponse response) t
- Page 2260:
3. Select the checkbox to add the s
- Page 2264:
You can deploy a Web application us
- Page 2268:
doPut is invoked to respond to a PU
- Page 2272:
«interface» javax.servlet.Servlet
- Page 2276:
NOTE: The URL query string uses the
- Page 2280:
The following HTML tags are used
- Page 2284:
String remarks = request.getParamet
- Page 2288:
} } allLocale[i].getDisplayName() +
- Page 2292:
The servlet processes the form and
- Page 2296:
} String phone = request.getParamet
- Page 2300:
The next request will submit the da
- Page 2304:
import javax.servlet.*; import java
- Page 2308:
} } catch (Exception ex) { System.o
- Page 2312:
public class RegistrationWithCookie
- Page 2316:
} " is now registered in the databa
- Page 2320:
«interface» javax.servlet.http.Ht
- Page 2324:
} // Set the action for processing
- Page 2328:
private String street; private Stri
- Page 2332:
Figure 42.25 The servlet returns an
- Page 2336:
package chapter42; import javax.ser
- Page 2340:
The servlet in the preceding exampl
- Page 2344:
through an I/O stream on the HttpSe
- Page 2348:
42.15 The statement out.close() is
- Page 2352:
Section 42.6 42.4* 2. Store the cou
- Page 2356:
(a) (b) Figure 42.33 The user enter
- Page 2360:
Figure 42.37 The web page lets you
- Page 2364:
43.1 Introduction Servlets can be u
- Page 2368:
Figure 43.4 A JSP page is translate
- Page 2372:
%> } if (n == 0) return 1; else ret
- Page 2376:
Compute Loan Payment Loan Amount
- Page 2380:
errorPage="HandleError.jsp" %> spec
- Page 2384:
Figure 43.7 The number of visits to
- Page 2388:
public void increaseCount() { count
- Page 2392:
creates a bean named loan for the L
- Page 2396:
method factorialBeanId.getFactorial
- Page 2400:
package chapter43; import j
- Page 2404:
Create DisplayTime.jsp (Listing 43.
- Page 2408:
The HTML file that displays the for
- Page 2412:
Web applications developed using JS
- Page 2416:
} ex.printStackTrace(); } return ta
- Page 2420:
Table No tables Select a
- Page 2424:
Java statements inserted in the jsp
- Page 2428:
43.8 What is wrong if the JSP scrip
- Page 2432:
(a) (b) Figure 43.13 The program di
- Page 2436:
***This is a bonus Web chapter CHAP
- Page 2440:
Click Next to display the dialog bo
- Page 2444:
for the first line to obtain inform
- Page 2448:
Figure 44.6 Choose JSF Managed Bean
- Page 2452:
You can display current time by inv
- Page 2456:
JSF Tag h:form h:panelGroup h:panel
- Page 2460:
Remarks: The t
- Page 2464:
The h:selectManyCheckbox element is
- Page 2468:
for (String s: minor) { allMinor +=
- Page 2472:
Figure 44.13 The user input i
- Page 2476:
package jsf2demo; import javax
- Page 2480:
The action attribute for the Add bu
- Page 2484:
The getResponse method converts gue
- Page 2488:
Figure 44.16 The correct input valu
- Page 2492:
Listing 44.12 ValidateForm.java pa
- Page 2496:
Step 3. Create a cascading style sh
- Page 2500:
} } ex.printStackTrace(); public St
- Page 2504:
Birth Date #{student.birthDate} D
- Page 2508:
Figure 44.22 This page lets the use
- Page 2512:
value="#{addressRegistration.requ
- Page 2516:
public String getTelephone() { retu
- Page 2520:
} status = ex.getMessage(); } retur
- Page 2524:
Section 44.6 44.13 What is a JSF se
- Page 2528:
44.5* (Addition quiz) Write a JSF p
- Page 2532:
Figure 44.30 44.10* The web page le
- Page 2536:
***This is a bonus Web chapter CHAP
- Page 2540:
In the New Project dialog box, choo
- Page 2544:
http://localhost:8080/WebServicePro
- Page 2548:
Right-click the ScoreWebServiceClie
- Page 2552:
private JTextField jtfName = new JT
- Page 2556:
specified arguments (if any) and se
- Page 2560:
eturn address; } else return null;
- Page 2564:
Figure 45.13 The Store button store
- Page 2568:
Last Name * First Name * &nb
- Page 2572:
questions for the client and grades
- Page 2576:
Assume that five True/False questio
- Page 2580:
Out of questions, correct
- Page 2584:
45.7 Can you test a Web service fro
- Page 2588:
***This is a bonus Web chapter CHAP
- Page 2592:
Server stub: An object that resides
- Page 2596:
java.rmi.registry.Registry +bind(na
- Page 2600:
2. Create a server implementation n
- Page 2604:
import java.rmi.registry.Registry;
- Page 2608:
5.4. Run the client StudentServerIn
- Page 2612:
2. Create a new server implementati
- Page 2616:
import java.rmi.registry.*; public
- Page 2620:
public interface CallBack extends R
- Page 2624:
import java.rmi.server.*; import ja
- Page 2628:
} return false; /** Check if the bo
- Page 2632:
} // Create cells and place cells i
- Page 2636:
} } } getSize().height - 20); } /**
- Page 2640:
Chapter Summary 1. RMI is a high-le
- Page 2644:
***This is a bonus Web chapter CHAP
- Page 2648:
Run from www.cs.armstrong.edu/liang
- Page 2652:
Listing 47.1 Searching an Element i
- Page 2656:
p0 e1 p1 e0 e e2 c0 c1 c2 rightChil
- Page 2660:
Case 1: u is a leaf 3-node or 4-nod
- Page 2664:
Locate the rightmost node in the le
- Page 2668:
16 27 27 34 16 34 3 15 24 25 29 50
- Page 2672:
import java.u
- Page 2676:
} } else { Tree24Node v = new Tree2
- Page 2680:
} } // Get the path that leads to e
- Page 2684:
} // Adjust child links for nonleaf
- Page 2688:
or 3-node, invoke insert23(e, right
- Page 2692:
22 System.out.print("\nAfter insert
- Page 2696:
20 15 24 27 50 3 16 22 23 25 29 60
- Page 2700:
for data stored on secondary storag
- Page 2704:
(a) Before a fusion is performed (b
- Page 2708:
Show the change of a 2-4 tree when
- Page 2712:
***This is a bonus Web chapter CHAP
- Page 2716:
ed node 27 is merged to its parent
- Page 2720:
Figure 48.4 The RBTree class extend
- Page 2724:
w 40 u y3 v 20 30 u x v 20 u 30 40
- Page 2728:
public boolean insert(E
- Page 2732:
sibling of v) (lines 32-33). If x i
- Page 2736:
If u is black and childOfu is red,
- Page 2740:
parent y y1 y u y1 parent childOfu
- Page 2744:
parent y y parent y2 childOfu is do
- Page 2748:
} fixDoubleBlack(grandparentOfu, pa
- Page 2752:
After deleting 25, the new tree is
- Page 2756:
import java.util.Arr
- Page 2760:
} else { // Case 2: v's sibling x i
- Page 2764:
(RBTreeNode)(parent.left) : (RBTree
- Page 2768:
} if (root == null) return; System.
- Page 2772:
Otherwise, y is red. In this case,
- Page 2776:
50 (black) The number of nodes is 7
- Page 2780:
public class TreePerformanceTest
- Page 2784:
7. If the external node to be delet
- Page 2788:
***This is a bonus Web chapter CHAP
- Page 2792:
Java 2D provides facilities to cons
- Page 2796:
ectangular frame. Figure 49.3 shows
- Page 2800:
import java.awt.*; import j
- Page 2804:
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8 9
- Page 2808:
import java.awt.*; import java.a
- Page 2812:
Figure 49.12 After scaling is appli
- Page 2816:
} } } BasicStroke.JOIN_BEVEL)); g2d
- Page 2820:
A TexturePaint is specified by an i
- Page 2824:
The statement in lines 36-37 Textur
- Page 2828:
} } } // Draw a quadratic curve g2d
- Page 2832:
class ShapePanel extends JPanel { p
- Page 2836:
} Graphics2D g2d = (Graphics2D)g; /
- Page 2840:
import java.awt.*; import jav
- Page 2844:
10. You can specify the width of th
- Page 2848:
(a) (b) Figure 49.27 (c) (d) (e) (a
- Page 2852:
49.11* (Plot the log, n, nlogn, and
- Page 2856:
***This is a bonus Web chapter CHAP
- Page 2860:
The JUnit test runner displays the
- Page 2864:
Figure 50.3 The test report is disp
- Page 2868:
** Construct a loan with specified
- Page 2872:
Figure 50.6 A new project named cha
- Page 2876:
Figure 50.9 The Create Tests dialog
- Page 2880:
Figure 50.12 The New Java Project d
- Page 2884:
Figure 50.14 The Loan class is crea
- Page 2888:
Figure 50.17 The test report is dis
Inappropriate
Loading...
Inappropriate
You have already flagged this document.
Thank you, for helping us keep this platform clean.
The editors will have a look at it as soon as possible.
Mail this publication
Loading...
Embed
Loading...
Delete template?
Are you sure you want to delete your template?
DOWNLOAD ePAPER
This ePaper is currently not available for download.
You can find similar magazines on this topic below under ‘Recommendations’.