Page 839 - Introduction to Programming with Java: A Problem Solving Approach
P. 839
Applets
applications versus, 188
calling graphics methods from, 182–
88 defined, 15
Application Programming Interface class library. See API library
Arguments
indexes as, 88
for instance variables, 202
in main method, 61
need to understand, 155 passing arrays as, 394 passing in OOP, 222–23, 224 passing references as, 257–59
Arithmetic operators. See also Operators common types in algorithms, 28
for numeric data, 74–75
precedence of, 28, 75–78
ArithmeticException errors, 579 arraycopy method, 381–82, 383–85 ArrayCopy program, 381 ArrayIndexOutOfBoundsException
errors, 372, 579 ArrayLists
for * multiplicity values, 476 creating and using, 409–13 purpose, 154
standard arrays versus, 422–23 storing primitives in, 414–17, 423
polymorphism and, 522–24
in try blocks, 563–64 Assignment statements
for arrays, 375, 397
basic coding conventions, 66–67 combining, 764
detailed analysis, 247, 248–52 embedded, 446–48
promotion in, 441, 522
for reference variables, 205–6, 247,
248–52
tracing, 44, 67–68
in try blocks, 563–64
Association, 140
Association classes, 498–500, 782–83 Association lines, 474, 781–82 Asterisk
in compound assignment operator, 80 lines of, 59, 759, 767
as multiplication operator, 28, 66
as multiplicity value, 474
to set off block comments, 58–59, 203
as wildcard character, 154–55
atan method, 158, 160
Attributes, diagramming for UML classes,
200
Autoboxing, 415–17
Automatically imported classes, 155
Auxiliary memory, 6–7
Averages, calculating, 40
AverageScore program, 447
Index 805 Blocks, 109, 216, 302
Body of loops, 37
Boolean logic, 139–42 Boolean methods, 226–27, 627 Boolean values, 107–8 boolean variables
default value, 209
defined, 751
for input validation, 138–39 when to use, 135–38
BorderLayout manager
as JFrame default, 696, 701, 714 overview, 698–704
Borders of containers, 699–700, 731–33 Borders of windows, 592
Bottom-up design, 321–23
Boundary tests, 311
Braces
in formal pseudocode, 47
positioning, 61–62, 300, 301–2, 761–63 for subordinate statements, 108–9, 302 in switch statements, 120
break statements
defined, 751
in looping structures, 456–57, 458 in switch statements, 119–20, 121
Breaking points for long statements, 301 BridalRegistry program, 124, 125 BudgetReport program, 175–76, 177 Buffers, 605
Bugs, 42–46. See also Tracing
Arrays
ArrayList class, 409–13 ArrayLists versus, 422–23 basic principles, 371–73
copying, 379–82
declaring and creating, 373 defined, 61, 139, 371
with histograms, 385–86
length property, 377–79
of objects, 402–9
partially filled, 379
polymorphism with, 524–30 runtime errors with, 579 searching, 388–92, 787, 788–89 shifting element values in, 382–85 sorting, 390, 393–96 two-dimensional, 396–402
Arrays class, 154
Arrays.sort method, 394–96 Arrowheads, in UML diagrams, 781–82 ASCII values
listed, 439, 746–47
overview, 438–40
for text data files, 615–17
as Unicode starting point, 459–60, 745
Ashtrays, 321
asin method, 158, 160
assert reserved word, 751
Asset management algorithm, 48–50 Assignment
compound, 79–80
between data types, 70, 74–75 directionality of, 29 embedded, 446–48
equality versus, 108
Apago PDF Enhancer
Azimuth, 544 Buttons
B
Backdoors, 164
Background colors, 674, 675–76, 720 Backslash character, 83–84, 627
Base classes, 472, 482
Base-16 number systems, 460, 514
Basic identities in Boolean algebra, 139–42 Basic Latin sub-table, 463
BearStore program, 417–22
Beck, Kent, 331
Behaviors of objects, 197
Biggest-number algorithms, 41–42
Binary I/O
advantages, 602, 603, 604
overview, 618–21
Binary number format, 5–6, 615–18 Binary searches, 390–92, 787, 788–89 Binding, 520
Bins, 386
Biological inheritance hierarchies, 479–80 Bits, 5–6
Blank lines
between code chunks, 66, 203, 300, 759 between declaration statements, 297 escape sequence for, 84
excessive, 303
between loops, 127
for readability, 59 Blank spaces, 303–4, 765 Block comments
javadoc, 772, 775, 776–77 syntax, 58–59
container regions as, 701 creating with JButton, 662–67 design principles, 695 GridLayout cells as, 705
byte variables, 434, 751
Bytecode, 13, 64
ByteOverflowDemo program, 435, 436
C
Calculator (Windows), 514–15 Calculator division, 74 Calendar class, 154, 329–31 Call stack traces, 579
Calling objects
defined, 152 identifying, 206–9, 263
camelCase, 28 Capital letters
in class names, 60, 64, 65, 766 converting to, 165–66, 171–72 identifier coding conventions, 64 ignoring in string comparisons, 90 for named constants, 270, 765
in variable names, 27–28 Car class, 476, 512
Car2 class, 254–56
Car2 program, 516 Car2Driver class, 254–56 Car3 class, 261 Car3Driver class, 260 Car4 class, 267 Car4Driver class, 268 Card Game program, 493–98