Page 840 - Introduction to Programming with Java: A Problem Solving Approach
P. 840

                806 Index case constants, 119, 301
Case conversion, 171–72
case reserved word, 751
Case sensitivity, 60
Case-based design, 323
Cast operators, 81–83, 442–43, 444, 524 Cat class, 520
catch blocks
generic, 572–73
in input validation, 561 multiple, 573–76 overview, 557–59, 751 postponing, 580–82
CDs, 6
Cells (GridLayout), 704–7
Central processing units, 3–4, 8
CEO salary algorithm, 34–35
Cerberean rat’s nest, 255
Chained method calls, 124, 246, 260–62 char data type
ASCII values, 438–40 assigning integers to, 443 concatenating, 440, 450 overview, 83, 751
as primitive type, 85 Character class, 165–66 Characters
determining position in strings, 170 permitted in identifiers, 64 underlying numeric values, 438–40
charAt method, 88–89, 117
Check box components, 721–24 Checked exceptions, 564–66, 569–72 Child classes, 482
Chips, 4
Class constants, 159, 352–53
Class diagrams, 780–83
.class extension, 64
Class headings, 60
Class methods
Character class, 165
identifying, 518
instance methods with, 350–51, 354–56 overview, 152, 349–52
searches with, 391–92
Class named constants, 352 Class paths, 757–58
class reserved word, 60, 751 Class variables, 198–99, 346–48 Classes. See also Hierarchies
association, 498–500
defined, 60, 198
inner, 658–62
naming rules, 64, 65, 300 organizing within programs, 472,
493–98, 768
relation to objects, 152, 198–99 selecting in top-down design, 312
Cleanup code, 582
Client view, 48
Clients, 305
Clock speed, 4
Close-window buttons, 21, 649, 651 Closing braces, 62. See also Braces Code reusability, 482
Coding-style conventions, 296–305, 759–68 CoinFlips program, 385–86, 387
col variables, 66
Collection classes, 364, 421 Collections API, 364 Collections class, 154 Colons, 120
ColorChooser program, 676–79 Colors
creating gradients of, 549–50 GUI controls overview, 674–79 setColor method, 185
for “white” illumination, 544
Columns
GridLayout, 704, 705–7 in UML class diagrams, 779
Combo boxes, 726–28
Command prompt windows, 18–19 Commas
as flag characters, 175
omitting from long numbers, 67 separating variables with, 65
Comments
aligning, 66
for blocks and obscure statements, 302–3 coding conventions for, 760–61
forms of, 58–59, 297
for methods in OOP code, 203 recommended for variables, 65, 301, 761
Commissioned class, 535, 536 Communication objects, 310 Commutation, 140
Compact discs, 6, 7
defined, 1–2, 7 portability, 12–14 source code, 10–12 steps in creating, 9–10
Concatenation
of char and string, 83, 440, 450 evaluating expressions, 450
of strings, 66, 87
Condition component of for loop, 129 Conditional operator expressions, 448–
49
Conditional structures, 30, 220. See also
if statements Conditions
defined, 31
in if statements, 107–8
in looping statements, 124, 126
Confirmation dialogs, 667, 668 Consistency in GUI design, 695 Console windows, 95, 99
const reserved word, 751 Constants
basic types, 71–72
in interfaces, 534–35 in Math class, 159–60 using, 73–74
wrapper class, 162
Constant-width characters, 461 Constructors
accessing class variables from, 351
with arrays of objects, 403 compareTo method, 166 benefits of, 265–66
Apago PDF Enhancer
Comparison operators, 108. See also Operators
Compilation, 12, 18–20, 63–64 Compilers, 18
Compile-time errors
with abstract classes, 532 defined, 70, 118, 556
expressions producing, 452
with GridLayout constructor, 707 with overriding methods, 518
Complex expressions, spacing of, 765 Components
adding to BorderLayout containers, 700–701
adding to GridLayout containers, 705
in composition, 472
as GUI elements, 645, 650 JPanel objects, 681–82, 714–15
Composites, 472 Composition
defined, 472
with inheritance, 490–93 inheritance versus, 495–97 UML indicators, 781 using, 472–79
Compound assignment operators, 79–80, 765
Compound conditions, 111–18 Compound statements, 109
Computer hardware, 2–8
Computer improvements, 8
Computer programs. See also Program
design
compiling into object code, 12
coding conventions for, 766–67 default, 267–70, 484, 486 defined, 180, 266
elegance of, 272
grouping in code, 304–5 instance constants with, 270 overloaded, 272–75, 485
in super- and subclasses, 485–86
Consumer threads, 795 Containers
BorderLayout, 699–704 defined, 650
for dialog boxes, 668–69 GridLayout, 704–7 JPanel, 682, 714–15, 733 layout manager role in, 695
Continuation lines, 301, 763–64 continue reserved word, 751
continue variables, 39
Continuous exponential distributions, 178,
179
Continuous testing, 311–12 Continuous uniform distributions, 176,
178
Control characters, 84, 438 Control statements
Boolean logic, 139–42 boolean variables in, 135–38 conditions in, 107–8
do loops in, 126–27
for loops in, 127–31
if statements in, 108–11
input validation, 138–39
logical operators in, 111–18 loop structure selection, 132–33
   838   839   840   841   842