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

                Pixels, 182, 183, 650
Plain text editors, 15–16 PLAIN_MESSAGE constant, 670 Plus sign
as addition operator, 28, 77
for concatenation, 63, 66, 83, 440 in formal pseudocode, 47
as prefix in UML diagrams, 216 as unary operator, 77
Polymorphism
abstract methods and classes, 530–33 with arrays, 524–30
assignment between classes and, 522–24 GUI applications, 544–50
with interfaces, 535–39
overview, 509, 519–20
Portability, 12–14, 680
Position determination of string characters,
170
Postfix mode, 443–46
pow method, 156, 410
Pre-built methods. See also API library
API library overview, 153–55 Character class, 165–66 Math class, 155–60 printf, 172–76
random number generation, 176–81 string, 166–72
use in bottom-up design, 322 wrapper classes, 161–64
private access modifier for class constants, 353 for class variables, 346 defined, 753
for helper methods, 305
for inner classes, 659
for instance variables, 202
prohibited with abstract methods, 533
Procedural programming, 196
Processes, 797
Processors, 3–4, 8, 14
Producer threads, 795
Program design. See also Object-oriented
programming
basic principles, 310–12
bottom-up approach, 321–23 case-based approach, 323
iterative enhancement in, 324–26 overview, 9, 10
selecting class relationships, 493–98 top-down approach, 312–21
Programmer view, 48
Programmer-defined exception classes, 566 Programming languages, 11
Programs, 1–2, 7. See also Computer
programs Prologues
coding conventions for, 759, 766–67 overview, 297
syntax, 59
Promotion of operands, 74–75, 441–42, 523 Prompts, 19, 29
Index 813 Readability, 59, 64–65, 67
ReaderMenu.java file, 736 readLine method calls, 573 ReadObject program, 622–23, 625 Read-only memory, 6 ReadTextFile program, 610 Realizable types, 480
Rectangle algorithm, 27, 28–29 Rectangles
drawing, 184, 185
in flowcharts, 30 Recursion, 784–92 Redundancy, avoiding
with helper methods, 306
with looping structures, 36 with super- and subclasses, 482
Reference types, 86, 509, 522 Reference variables
anonymous objects versus, 417, 418 ArrayList initialization, 409 assigning values to, 205–6, 247, 248–52 charAt and println methods, 88 copying, 248
declaring, 205
default value, 209, 247 instantiating, 205, 247
null, 512–13
objects versus, 204, 205 omitting dot prefixes with, 307 overview, 86, 203–4
passing as arguments, 257–59 two in one method call, 254
Regions, 699. See also BorderLayout manager
Registering listeners, 657 Relational operators, 136–38 Relative paths, 627 removeStudent method, 568–69 renameTo method, 627
repaint method, 686
Repetitive tasks, 123, 393 replaceAll method, 171 replaceFirst method, 171 Replacement of text, 171 Requirements analysis, 9
Reserved words, 60, 61, 751–54 reset method, 626
Resolution (screen), 650
return istatements,388
return statement, 218–22, 227, 753 return thisstatement,260–61 Return types. See also Data types
matching to method headings, 218–20 omitting from constructor headings, 266 for overriding methods, 488
Return values
Boolean, 226, 254
defined, 155
return statement overview, 218–22
RGB values, 675. See also Colors Robustness of algorithms, 41 ROM, 6
Root directories, 627
Rotation of graphic images, 549–50 round method, 152, 158, 160
Precedence of operations
basic, 28, 75–78
in Boolean algebra, 139–40 with logical operators, 113–14 summary list, 749–50
Precision, 175, 437
Predator-prey interactions, 795–803 Prefix mode, 443–46
Preliminary class diagrams, 493–95 Primitive data types. See also Data types
storing in ArrayLists, 414–17, 423
wrapper classes, 161–64 Primitive variables, 85–86 print method, 134 print statements
avoiding in toString methods, 515 tracing, 44
unneeded, 225
Print statements (pseudocode), 26, 27, 32–33
PrintCharFromAscii program, 444 printf method, 172–76 PrintInitials program, 95 PrintLineFromFile program, 573, 574 PrintLineFromFile2 program, 573–76 println method
charAt method versus, 88–89 in nested loops, 134
purpose, 62
to write text, 605
PrintPO program, 94
PrintPOGUI program, 98 PrintUtilities class, 354, 355 PrintWriter class, 603, 604, 605–6 PrintWriter constructor calls, 606–8
Apago PDF Enhancer
protected access modifier, 539–44, 753 Protocols, 621
Prototyping, 324
Pseudocode
converting to source code, 11 defined, 10, 26
indentation in, 32
proceeding without, 11–12 programming code versus, 57 varieties of, 46–48
public access modifier
for class constants, 353 defined, 60, 61, 753
for instance variables, 202 optional for interfaces, 534
public methods, 312, 314, 315–16 Q
Queries
with do versus while loops, 127 in nested loops, 41–42 terminating loops with, 38, 39
Question mark icon, 97, 670 Quotation marks, 26, 62, 83, 84
R
Radio buttons, 695, 724–26
Random access memory (RAM), 6, 8 Random class, 154, 179–81
random method, 158, 163–64 Random numbers, 176–81 randomNumbers.txt, 609 RandomTest program, 181
   845   846   847   848   849