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
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Figure 50.15<br />
The New JUnit Test Case dialog box creates a Test class.<br />
Figure 50.16<br />
The LoanTest class is au<strong>to</strong>matically generated.<br />
You can now modify LoanTest by copying the code from Listing 50.2. Run<br />
LoanTest.java. You will see the test report as shown in Figure 50.17.<br />
16
Figure 50.15 The New JUnit Test Case dialog box creates a Test class. Figure 50.16 The LoanTest class is au<strong>to</strong>matically generated. You can now modify LoanTest by copying the code from Listing 50.2. Run LoanTest.java. You will see the test report as shown in Figure 50.17. 16
- 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 1678:
This page intentionally left blank
- Page 1682:
Java Quick Reference Console Input
- Page 1686:
35.1 Introduction Many Web sites ma
- Page 1690:
traditional one called bokmål and
- Page 1694:
DateFormat formatter = DateFormat.g
- Page 1698:
javax.swing.JPanel javax.swing.JPan
- Page 1702:
43 panel3.add(panel1, BorderLayout.
- Page 1706:
javax.swing.JPanel javax.swing.JApp
- Page 1710:
71 showDayNames(); // Display day n
- Page 1714:
1 import java.awt.*; 2 impor
- Page 1718:
java.text.NumberFormat +getInstance
- Page 1722:
If you want even more control over
- Page 1726:
51 p2.setLayout(new GridLayout(3, 3
- Page 1730:
A resource bundle is a Java class f
- Page 1734:
Figure 35.10 The program displays t
- Page 1738:
41 // Text fields for monthly payme
- Page 1742:
157 NumberFormat.getCurrencyInstanc
- Page 1746:
characters, Cp939 for Japanese char
- Page 1750:
35.7 In line 73 of WorldClockContro
- Page 1754:
Figure 35.17 The program displays t
- Page 1758:
***This is a bonus Web chapter CHAP
- Page 1762:
class Data members Methods Construc
- Page 1766:
36.4.1 Event Classes and Event List
- Page 1770:
21 /** MyListener class */ 22 class
- Page 1774:
9 4 public class CourseWithActionEv
- Page 1778:
ActionEvent(Object source, int id,
- Page 1782:
Let us define EnrollmentEvent as th
- Page 1786:
26 } 27 28 public ArrayList getStud
- Page 1790:
22 } 23 } 24 } Tim Johnson attempt
- Page 1794:
(Enable MessagePanel to fire Action
- Page 1798:
message “You have an appointment
- Page 1802:
***This is a bonus Web chapter CHAP
- Page 1806:
Figure 37.1 Swing top-level contain
- Page 1810:
The layout manager places the compo
- Page 1814:
«interface» java.awt.LayoutManage
- Page 1818:
51 // Show the first component in c
- Page 1822:
example, the next code adds a rigid
- Page 1826:
79 } Two containers of the Box clas
- Page 1830:
20 add(jbtBlue); 21 add(jbtGreen);
- Page 1834:
Figure 37.8 The DiagonalLayout mana
- Page 1838:
84 public void setMajorDiagonal(boo
- Page 1842:
which in turn invokes the layoutCon
- Page 1846:
To set a corner component, you can
- Page 1850:
77 78 if (location == "UPPER_LEFT_C
- Page 1854:
11 public DisplayFigure() { 12 squa
- Page 1858:
1 import java.awt.*; 2 impo
- Page 1862:
in §12.9, “Common Features of Sw
- Page 1866:
+createBevelBorder(type: int): Bord
- Page 1870:
Create and register listeners to im
- Page 1874:
102 btgBorderStyle.add(jrbEtched);
- Page 1878:
depending on the selection of the r
- Page 1882:
Programming Exercises Section 37.3
- Page 1886:
Figure 37.26 Four figures are displ
- Page 1890:
38.1 Introduction Java provides a c
- Page 1894:
(a) (b) (c) Figure 38.2 (a) A check
- Page 1898:
1. Create a menu bar and set it in
- Page 1902:
98 public void actionPerformed(Acti
- Page 1906:
Figure 38.4 A popup menu is display
- Page 1910:
TIP Java provides a new setCompone
- Page 1914:
The toolbar buttons are floatable.
- Page 1918:
JButton jbt = new JButton(exitActio
- Page 1922:
78 this.name = name; 79 } 80 81 @Ov
- Page 1926:
Figure 38.11 There are five types o
- Page 1930:
methods return a String that is ent
- Page 1934:
4 public static void main(String ar
- Page 1938:
Create a custom dialog component na
- Page 1942:
106 color = new Color(redValue, gre
- Page 1946:
(a) (b) Figure 38.19 An instance of
- Page 1950:
Figure 38.21 The editor enables you
- Page 1954:
108 jta.setBackground(selectedColor
- Page 1958:
Test Questions 3. A popup menu, als
- Page 1962:
menu (see Figure 38.22). Show a mes
- Page 1966:
file name is displayed in the text
- Page 1970:
***This is a bonus Web chapter CHAP
- Page 1974:
The Java event delegation model pro
- Page 1978:
60 61 /** Remove an action event li
- Page 1982:
6 private CircleModel model; 7 priv
- Page 1986:
The controller CircleController pre
- Page 1990:
7 8 // Set properties in the model
- Page 1994:
JavaBeans properties with get and s
- Page 1998:
«interface» javax.swing.SpinnerMo
- Page 2002:
calendarField is Calendar.DAY_OF_WE
- Page 2006:
22 panel1.setLayout(new GridLayout(
- Page 2010:
A JSpinner object can fire javax.sw
- Page 2014:
For example, suppose there are five
- Page 2018:
21 public ListPropertiesDemo() { 22
- Page 2022:
existing items, you have to use a l
- Page 2026:
4 5 public class ListModelDemo exte
- Page 2030:
You can use JList’s default cell
- Page 2034:
Small icon Large icon Figure 39.24
- Page 2038:
JavaBeans properties with get and s
- Page 2042:
Figure 39.27 The image and the text
- Page 2046:
properties can be accessed and modi
- Page 2050:
39.15 Why is the cell renderer for
- Page 2054:
in an ImageViewer. Set the dimensio
- Page 2058:
***This is a bonus Web chapter CHAP
- Page 2062:
NOTE: All the supporting interfaces
- Page 2066:
esizing a column affects the width
- Page 2070:
86 87 // Register and create a list
- Page 2074:
specified cells (lines 30-32). Figu
- Page 2078:
Figure 40.8 shows the properties, c
- Page 2082:
40.4 Auto Sort and Filtering Auto s
- Page 2086:
54 } 55 } The example creates a Tab
- Page 2090:
9 // Create table column names 10 p
- Page 2094:
141 } 142 catch (Exception ex) { 14
- Page 2098:
Table cells are painted by cell ren
- Page 2102:
Create image icons private ImageIco
- Page 2106:
import java.awt.*; import ja
- Page 2110:
1 import java.awt.*; 2 im
- Page 2114:
120 @Override 121 public void actio
- Page 2118:
oot is always the first element (in
- Page 2122:
All the methods related to path sel
- Page 2126:
95 }); 96 } 97 } Four trees are cre
- Page 2130:
4 javax.swing.tree.TreeModel model
- Page 2134:
In graph theory, depth-first traver
- Page 2138:
traversals). Some examples of using
- Page 2142:
the selected paths in a text area,
- Page 2146:
You can choose a selection mode fro
- Page 2150:
79 TreeSelectionModel.DISCONTIGUOUS
- Page 2154:
(DefaultTreeCellRenderer)jTree1.get
- Page 2158:
3. JTable and JTree are in the java
- Page 2162:
(Display a table for data from a te
- Page 2166:
Figure 40.36 The file explorer expl
- Page 2170:
41.1 Introduction The preceding cha
- Page 2174:
jPanel2.setLayout(new BorderLayout(
- Page 2178:
Find the number of columns in the r
- Page 2182:
create table Person ( firstName var
- Page 2186:
} copyFile(); } catch (Exception ex
- Page 2190:
atch updates. If the driver does no
- Page 2194:
public class ScrollUpdateResultSet
- Page 2198:
complex query might not be able to
- Page 2202:
owSet.setCommand("select firstName,
- Page 2206:
20 import java.sql.*; im
- Page 2210:
import java.sql.*; import javax.s
- Page 2214:
** Return the number of columns in
- Page 2218:
Define two classes: TestTableEditor
- Page 2222:
import javax.swi
- Page 2226:
} } }); listSelectionModel.addListS
- Page 2230:
In the preceding statement, the des
- Page 2234:
} Class.forName("com.mysql.jdbc.Dri
- Page 2238:
Test Questions Do the test question
- Page 2242:
Figure 41.8 The Course table is dis
- Page 2246:
***This is a bonus Web chapter CHAP
- Page 2250:
A Web browser requests a static HTM
- Page 2254:
this purpose. Java servlets are Jav
- Page 2258:
Figure 42.3 (a) Choose Web Applicat
- Page 2262:
Figure 42.8 A new servlet class is
- Page 2266:
public void service(ServletRequest
- Page 2270:
HttpServlet inherits abstract class
- Page 2274:
public void destroy() { ... } } //
- Page 2278:
Student Registration Form Studen
- Page 2282:
You can create the HTML file from N
- Page 2286:
(a) (b) Figure 42.18 The GET method
- Page 2290:
If you choose an Asian locale (e.g.
- Page 2294:
State Georgia-GA Oklahoma-OK India
- Page 2298:
} } pstmt.setString(9, zip); pstmt.
- Page 2302:
Using Hidden Data for Session T
- Page 2306:
} "value=" + email + " name=\"email
- Page 2310:
javax.servlet.http.Cookie +Cookie(n
- Page 2314:
} out.println("Street: " + street);
- Page 2318:
Cookies are automatically sent to t
- Page 2322:
public class RegistrationWithHttpSe
- Page 2326:
} } pstmt.setString(2, address.getF
- Page 2330:
} return this.city; } public void s
- Page 2334:
The servlet reads the characters fr
- Page 2338:
(2 * Math.PI / 60))); int ySecond =
- Page 2342:
} } "ImageContentWithDrawing\" alig
- Page 2346:
Section 42.3 42.6 Can you display a
- Page 2350:
42.1* (Factorial table) Write a ser
- Page 2354:
The servlet computes the loan payme
- Page 2358:
42.11* Cookie 3: name is “count
- Page 2362:
***This is a bonus Web chapter CHAP
- Page 2366:
Figure 43.1 You can create a JSP pa
- Page 2370:
A JSP declaration is for declaring
- Page 2374:
equest represents the client’s re
- Page 2378:
What is wrong if the JSP scriptlet
- Page 2382:
Normally you create an instance of
- Page 2386:
The scope attribute specifies the s
- Page 2390:
Instead of using the value attribut
- Page 2394:
} /** Obtain factorial */ public lo
- Page 2398:
FactorialBean Compute Fac
- Page 2402:
} } return dateFormat.format(calend
- Page 2406:
creates a prepared statement for st
- Page 2410:
Listing 43.18 StoreStudent.jsp
- Page 2414:
Listing 43.19 DBBean.java
- Page 2418:
DBLogin JDBC URL jdbc:odbc:Exa
- Page 2422:
%> You start the applic
- Page 2426:
encounter a delay, JSP developers s
- Page 2430:
(Store cookies in JSP) Rewrite Exer
- Page 2434:
(Guess capitals) Write a JSP that p
- Page 2438:
44.1 Introduction The use of ser
- Page 2442:
Figure 44.4 A default JSF page is c
- Page 2446:
NOTE: The XML tag names are case-se
- Page 2450:
Figure 44.8 A JavaBean for JSF was
- Page 2454:
Display Current Time The curre
- Page 2458:
Student Registration
- Page 2462:
Figure 44.12 The resources folder w
- Page 2466:
public String getFirstName() { retu
- Page 2470:
Gender
- Page 2474:
The h:selectManyListbox element is
- Page 2478:
} } The managed bean has three prop
- Page 2482:
Step 2. Create a JSP facelet named
- Page 2486:
Table 44.2 JSF Input Validator Tags
- Page 2490:
For each input tex
- Page 2494:
} } If an input is invalid, its val
- Page 2498:
package jsf2demo; import javax.
- Page 2502:
Display Student
- Page 2506:
} font-size:1em; padding:3px 7px 2p
- Page 2510:
xmlns:f="http://java.sun.com/jsf/co
- Page 2514:
package jsf2demo; import j
- Page 2518:
} public String getRequiredFields()
- Page 2522:
6. In JSF, the objects that are acc
- Page 2526:
44.2* (a) The JSF page displays fac
- Page 2530:
44.8* (a) The program displays five
- Page 2534:
displays four random cards and disp
- Page 2538:
45.1 Introduction Web service is
- Page 2542:
} Lines 4-5 import the annotation
- Page 2546:
***END NOTE Where host is the host
- Page 2550:
NOTE: When you created a Web servic
- Page 2554:
Figure 45.9 The client request and
- Page 2558:
Right-click the WebServiceProject n
- Page 2562:
The findAddress method searches the
- Page 2566:
Figure 45.14 The Address.java is au
- Page 2570:
* required fields Lines 2-4
- Page 2574:
import java.util.List; import java.
- Page 2578:
True False
- Page 2582:
Web service Web service client refe
- Page 2586:
45.5* (Quiz) The user needs to answ
- Page 2590:
46.1 Introduction Remote Method Inv
- Page 2594:
When a client invokes a remote meth
- Page 2598:
ServerInterface server = new Server
- Page 2602:
StudentServerInterfaceImpl implemen
- Page 2606:
} } student = (StudentServerInterfa
- Page 2610:
RMI clients can directly invoke the
- Page 2614:
} } catch (Exception ex) { System.o
- Page 2618:
notifying a player is to invoke a m
- Page 2622:
Now the most critical question is h
- Page 2626:
} board[row][column] = token; // No
- Page 2630:
} public void mark(int row, int col
- Page 2634:
} /** Inner class Cell for modeling
- Page 2638:
Key Terms TicTacToeImpl is a server
- Page 2642:
(Limit the number of clients) Modif
- Page 2646:
47.1 Introduction A 2-4 tree, a
- Page 2650:
Tree m 0 Tree24 -root: Tree24Node +
- Page 2654:
Figure 47.6 The splitting operation
- Page 2658:
} } root.child.add(u); // u is the
- Page 2662:
oot root ….. ….. ….. …..
- Page 2666:
oot parentOfu u Figure 47.13 The no
- Page 2670:
subtrees from the left to right rec
- Page 2674:
** Return true if the element is fo
- Page 2678:
while (current != null) { list.add(
- Page 2682:
} } } /** Locate the insertion poin
- Page 2686:
} // Left as exercise return null;
- Page 2690:
The locate(e, node) method locates
- Page 2694:
Preorder: 23 20 3 15 22 27 60 24 29
- Page 2698:
23 20 27 60 3 15 22 24 29 70 (f) Af
- Page 2702:
should choose an appropriate order
- Page 2706:
transfer operation Chapter Summary
- Page 2710:
Returns the parent for the specifie
- Page 2714:
48.1 Introduction A red-black t
- Page 2718:
20 20 16 15 34 15 34 15 34 3 16 25
- Page 2722:
Figure 48.6 The animation tool enab
- Page 2726:
w 40 w 40 u v 30 50 x v 30 50 x 25
- Page 2730:
Case 1.3: w < v < u, Restructure an
- Page 2734:
34 34 15 50 15 50 20 3 20 3 20 15 3
- Page 2738:
y parent childOfu is double black y
- Page 2742:
Figures 48.22 and 48.22 show that c
- Page 2746:
public boolean d
- Page 2750:
} } parent.setRed(); // Color paren
- Page 2754:
Figure 48.28 Delete elements from a
- Page 2758:
} // v is the parent of of u, if ex
- Page 2762:
} // current node is an internal no
- Page 2766:
db = parent; parent = grandparent;
- Page 2770:
u) from the path. If u is the root,
- Page 2774:
} } tree.delete(15); printTree(tree
- Page 2778:
48.8 Performance of the RBTree Clas
- Page 2782:
elements from the list to a tree (l
- Page 2786:
48.2* (2-4 tree to red-black tree)
- Page 2790:
49.1 Introduction Using the methods
- Page 2794:
«interface» java.awt.Shape +conta
- Page 2798:
RoundRectangle2D models a rectangle
- Page 2802:
instance of Line2D and Shape. The i
- Page 2806:
Figure 49.8 The rectangles are disp
- Page 2810:
You can use the scale(double sx, do
- Page 2814:
The parameter cap is one of three v
- Page 2818:
You can use the setColor(Color c) m
- Page 2822:
} } } texturePaint = new TexturePai
- Page 2826:
where (x1, y1) and (x2, y2) specify
- Page 2830:
«interface» java.awt.Shape java.a
- Page 2834: A A B C B C (a) (b) Figure 49.23 Th
- Page 2838: The program translates the coordina
- Page 2842: Figure 49.26 The Area class can be
- Page 2846: 49.5 How do you render a Shape obje
- Page 2850: field Angle and press the Rotate bu
- Page 2854: 49.18* (Scale and rotate graphics)
- Page 2858: 50.1 Introduction At the very begin
- Page 2862: package mytest; import org.jun
- Page 2866: } @Before public void setUp() throw
- Page 2870: } /** Return loan date */ public ja
- Page 2874: Figure 50.7 The Loan class is creat
- Page 2878: Figure 50.11 The test report is dis
- Page 2882: Figure 50.13 The New Java Class dia
- 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’.