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

                812 Index Naming rules
for classes, 64, 65, 300 for constructors, 266 for methods, 64, 300 overview, 64–65
for variables, 27–28, 66, 300
for variables in overloaded methods, 262 for variables in separate blocks, 223
NASA space program, 325
native reserved word, 753
Nested looping structures, 41–42, 133–35,
397
NestedLoopRectangle program, 133–35 Netscape, 14
New line character, 616–17, 701
new operator
in array instantiation, 375 basic purpose, 205–6, 753
in constructor calls, 180, 274
Newline character, 84
next method, 92, 93, 95 nextBoolean method, 180 nextDouble method, 92, 94, 180 nextFloat method, 92 nextGaussian method, 180 nextInt method
basic actions of, 92, 94 parseInt method versus, 561 Random class, 180
source code heading, 155
Object-oriented programming. See also In- heritance; Program design
argument passing, 222–23, 224 array basics, 402–9
calling object identification, 206–9 constructor overview, 265–72 driver classes, 203–6
instance variable default values and per- sistence, 209–10
local variables overview, 216–18 method-call chaining, 260–62 modeling and implementing classes,
199–203
multiple driven classes, 275–84
object creation details, 246–47 overloaded constructors, 272–75 overloaded methods, 262–65
overview, 152, 196–99, 215–16
passing references as arguments, 257–59 simulation techniques in, 227–34 specialized methods in, 224–27
testing objects for equality, 252–57 tracing, 210–15
ObjectOutputStream class, 604 Objects
anonymous, 417 arrays of, 402–9
basic features, 196–97 Color, 675
creating, 246–47 defined, 86, 152
Overflow errors, 435, 436
Overhead, 784
Overloaded constructors, 272–75, 485 Overloaded methods, 262–65
Overriding methods. See Method overriding
P
Package paths, 756
package reserved word, 753 Packages
custom, 756–58
defined, 153
GUI groupings, 679–80 hierarchical organization, 755–56
paint method, 185
paintComponent methods, 545–46, 586,
588, 686 Parameters
defined, 202
local variables versus, 223, 309
in overloaded constructors, 272–75 in overloaded methods, 262–63
Parent classes, 482 Parentheses
with calculated variables, 33
with cast operators, 81–82, 83 coding conventions for, 764
for control statement conditions, 108 as flag characters, 175
with logical operators, 113–14
in method calls, 89, 377
nextLine method, 93–94
nextLong method, 92
Non-static method error messages, 350–51 Non-void return types, 580
Nonvolatile memory, 6
Not equal to sign, in formal pseudocode, 47 “Not” operator, 118
Notepad, 16–18
null values
defined, 753
terminating loops at, 527 testing for, 512–13
NullPointerException error, 527, 571
NumberFormatException errors, 577–79
NumberList program, 577–80 Numeric data
basic types, 69–70, 434–37 converting, 443
operators for, 74–75
numOfPoints parameter, 584 O
Oak, 14 Object class
equals method, 510–11, 513 overview, 509
toString method, 514, 515
Object code, 12–13 Object diagrams, 780 Object I/O
advantages, 602, 603, 604
implementing, 622–26 ObjectInputStream class, 604
reference variables versus, 204, 205 optional with return statements, 227 Apago PDF Enhancer
temporary, 249–52
testing for equality, 252–57 Off-by-one errors, 37, 456
Offset continuous uniform distributions,
176, 178 OK buttons, 21
One-line comments, 58
Opening braces, 61. See also Braces Opening text files, 604–5, 608–9 Operands, 28, 74
Operating systems, 16
Operations, diagramming for UML classes,
200 Operators
cast, 81–83
common types in algorithms, 28 comparison, 108
compound assignment, 79–80 increment and decrement, 79
logical, 111–18
for numeric data, 74–75
precedence of, 28, 75–78, 113–14, 749–
50
shortcut, 765 spacing of, 764–65
“Or” operator, 116–18 Output devices, 2–3 Output formatting, 172–76 Output operations
binary, 618–19 object-based, 622 text-based, 604–8
Ovals, 185
in switch statements, 120
when to use, 28, 66, 67, 377–79 parseDouble method, 162 parseInt method
basic purpose, 162, 664
potential errors with, 561, 577, 667 Parsing, 611
Parsing errors, 611
Partially filled arrays, 379 Pass-by-value, 223, 224
Passed-in references, 257 Paths
directory, 19, 627
package, 756, 757–58
Payroll program, 524–30, 535–39, 540–44 Payroll3 program, 538–39, 780–83 Payroll4 class, 540
PennyJar class, 355–56, 357, 358 Pentagon ashtrays, 321
Percent symbol
in compound assignment operator, 80 as conversion specifier, 454
with format specifier, 174
as modulus operator, 75
Peripherals, 8
Persistence, 210, 218
Person class, 257–59, 483–84, 493 Person/Employee/FullTime hierar-
chy, 483–89
Pets program, 521–22 phoneList array, 371–72 Photographs, 182, 183, 185–86 PI constant, 159
   844   845   846   847   848