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

                String class, 61, 65, 86
String[] arguments, 61 StringBuffer class, 621 String.format method, 634, 715–19 StringMethodDemo program, 169 Strings
adding to graphics, 185
char type versus, 83
comparing, 116–17, 254–55 concatenating, 66, 87, 450 converting to primitive types, 98–99,
161–62, 561
declaration syntax, 65
defined, 26, 61
escape sequences in, 84–85
Java features for manipulating, 86–90 parsing, 664
Strongly typed languages, 68, 441 Structured programming, 30 Stubs, 312, 316–17
Student class, 298, 299 StudentDriver class, 297 StudentList class, 567–69 StudentList2 class, 580–83 StudentListDriver class, 568 Style conventions, 296–305 Subclasses, 481–88
equals method, 510
format specifier, 174
importance to programming, 11 instance constants, 270
instance method calls, 206 interface definitions, 534
Java versus pseudocode, 57 looping structures, 108–9, 119–20,
123–24, 126, 129
overloaded constructors, 275 pre-built method calls, 152, 155 string–primitive conversions, 161 try and catch block, 557
Syntax errors, 20
System class, 155 System.arraycopy method, 381–82,
383–85
System.out.print statement, 91 System.out.println statement,
62–63, 91
T
Tab character, 84
Table formats, 704–7
Tagging objects for serialization, 622 Tags (HTML), 613, 615, 701
Tags (javadoc), 773–75
tan method, 158, 160 TemperatureConverter program example,
73–74
Temporary objects, 249–52
Index 815 as instance variable identifier, 202, 208
omitting, 327–29
Threads, 794–803 Three-dimensional graphics, 544–50 throw reserved word, 754 Throwing an exception, 559
throws clauses, 580–82, 754 Tic-tac-toe example, 707–12
Time class, 326
Times and dates, 329–31
Title bars, 21, 650
Tokens, 93, 611
toLowerCase method, 171–72 Top-down design, 312–21
Top-level classes, 659
toString methods, 162, 514–18 toUpperCase method, 171–72 Towers of Hanoi, 790–92
Tracing. See also Testing
with constructors, 275 object-oriented programs, 210–15 of operations, 80
in pseudocode, 42–46
setup for, 67–68, 130–31, 368
transient reserved word, 754 Transitions in UML diagrams, 778 Trigonometric math methods, 158, 160 trim method, 171–72
true reserved word, 754 TruthTable program, 140, 141 try blocks
Subordinate statements, 32, 33, 108–9 Subpackages, 679
Subscripting, 373
substring method, 169–70 Substring retrieval, 169–70 Subtraction, 11, 28, 77
Subtrees, 539
Sun Java API Web site, 153–54, 322 Sun Microsystems, 14
super keyword, 485, 487–88, 754 Superclasses
basic features, 481–82 constructors in, 485–86 implementing, 483–85 initial diagramming, 495 JFrame as, 650
method overriding and, 486–88 Survivor program, 413, 414 Swapping algorithm, 257–59 Swimlanes, 779
Swing library, 680, 734–35 SwingConstants interface, 704
Switch class (Garage Door program), 281 switch statements, 119–23, 754 Synchronization, 800–803 synchronized reserved word, 754 Syntax
anonymous inner classes, 661
arrays and ArrayLists, 373, 375, 409,
410
cast operators, 442
charAt and println methods, 88–89 class constants, 353
class methods, 349–50
class variables, 346
comment, 58–59, 297
conditional operator expressions, 448–49 declaration statements, 65
defined, 10
Apago PDF Enhancer
Temporary print statements, 225
details in implementing, 563–64 in input validation, 561 overview, 557–59, 754
try-catch structures
for checked exceptions, 569–72
with generic catch blocks, 572–73 in input validation, 561
moving to calling methods, 580–82 with multiple catch blocks, 573–76 overview, 557–59
for unchecked exceptions, 566–67,
568–69
Two-dimensional arrays, 396–402 Type casting, 442–43
Types. See Data types
U
UML class diagrams
for arrays of objects, 404
basic features, 199–200, 215–16, 778–83 composition and aggregation in, 473,
474, 525
Garage Door program, 278 inheritance hierarchies, 480–82 use in top-down design, 314, 318
Unary operators, 77
Unboxing, 415–17
Unchecked exceptions, 564–69 Underlining in UML diagrams, 216 Unicode characters
ASCII values versus, 439 for binary data files, 617 need for, 440
overview, 459–63, 745–48 Web site, 745
Temporary variables, 258, 259 Terminate abnormally, 89 Termination of loops
basic principles, 37
with boolean variables, 138 common techniques, 38–41
do loops, 127
length property for, 402
with return statements, 221–22
Ternary operators, 448 TestExpressions program, 76 Testing. See also Tracing
defined, 9
freezing random numbers for, 181 local main methods for, 327 overview, 311–12
standard data banks for, 326
TestObject class, 622, 623 TestOperators program, 81 Text boxes, 653–54, 657–58 Text editors, 15–16
Text format, 615–18 Text I/O
advantages, 602, 603 HTMLGenerator example, 612–15 input implementations, 608–11 output implementations, 604–8
Text replacement, 171 TextEdit, 16
this constructor calls, 275 this reference
as calling object identifier, 186, 208–9, 263
defined, 754
   847   848   849   850   851