Page 844 - Introduction to Programming with Java: A Problem Solving Approach
P. 844
810 Index Indexes (array) (continued)
defined, 371
invalid, 568–69, 580–82
with two-dimensional arrays, 396–97
indexOf methods, 170 IndexOutOfBoundsException, 568,
580–82
Infinite loops, 37, 46, 125–26 Information dialog boxes, 21, 95, 96 Inheritance
with aggregation and composition, 490–93
assignment between classes and, 522–24 association versus, 500
composition versus, 495–97
defined, 472
equals method, 510–13
overview, 479–83
polymorphism with, 524–30
sample implementations, 483–89 spanning hierarchies with interfaces,
535–39
toString method, 514–18
Initial states, in UML diagrams, 778 Initialization
array elements, 375–76, 397 assigning values during, 40, 42, 80 combining with instantiation, 266 of named constants, 270
in try blocks, 563–64
Initialization component of for loop, 129 Initialization statements
basic syntax, 68–69
blank lines between, 297 garbage values in, 80
for instance variables, 202, 206 in try blocks, 563–64
Inner classes anonymous, 659–62 basic features, 658–59 defined, 753
inner reserved word, 753 Input devices, 2
Input dialogs, 97–99, 667, 668 input statements, 44
Input validation, 138–39, 561. See also Ex- ception handling
InputMismatchException objects, 558–59
Input/output classes, 602–4 Input/output operations
binary, 618–21
HTMLGenerator example, 612–15 major approaches, 602–4 object-based, 622–26
text-based input, 608–11 text-based output, 604–8
Inputs
into algorithms, 29
invalid entries, 556–57 Scanner class features, 90–94 testing, 311, 326
text-based, 608–11
Insertions into strings, 172 insets objects, 592
InstallationDialog program, 96 Installation-options windows, 723–24 Instance constants, 270, 352
Instance methods
calling, 206–9
with class methods, 350–51, 354–56 defined, 152, 198–99
Instance named constants, 352 Instance variables
accessing without this reference, 327–29
in containing classes, 476
copying, 249
declaring, 200–203
default values and persistence, 209–10,
247
defined, 198–99
encapsulation with, 309–10 initial diagramming, 495
local variables versus, 217
text box components as, 654, 663
instanceOf operator, 522, 523, 753 Instances, objects as, 198 Instantiation
arrays, 375, 403
combining with initialization, 266 defined, 205, 247
File objects, 626–27
objects with same instance variables, 249 temporary objects, 249–52
Italics, 32
ItemListener interface, 723 Iterations
confirming number of, 38–39 defined, 37
using for-each loops, 421–22 using for loops, 127–31
Iterative enhancement, 324–26
J
Java API Web site, 153–54, 322
Java Development Kit, installing, 18 .java extension, 64
Java programming language, 14–20 Java Virtual Machine, 13–14, 18, 74–75 java.awt package, 649, 679, 680 java.awt.event package, 658 javac command, 19
javadoc tool, 296, 771–77
java.io package, 602
java.lang package, 155
JavaServer Pages, 15
java.util package, 154 javax.swing package, 629, 649, 651,
680, 725
javax.swing.border package, 733 JButton component, 662–67 JCheckBox components, 721–24 JComboBox components, 726–28 JComponent class, 651–52 JFileChooser class, 629–34
Apago PDF Enhancer
Instruction sets, 13n
int cast operator, 82, 158 JFrame class, 461, 649–51
int constants, 71 int data type
converting strings to, 162, 561 default value, 209
defined, 753
dialog input, 98
as primitive type, 85
when to use, 69, 434 Integers
assigning to characters, 443 dialog input, 98
division of, 75, 82 initializing, 209
when to use, 69, 434–35
Integrated development environments, 15,
214–15
Intelligent appliances, 14 interface reserved word, 753 Interfaces
with anonymous inner classes, 661 defined, 305, 658
main uses, 533–39 SwingConstants, 704
InterruptedExceptions, 797 Invalid input, 93
IOException error, 571, 572, 622 is keyword, 226
“Is-a” relationships, 490 isDigit method, 165 isDirectory method, 627 isEmpty method, 169
isFile method, 627 isSelected method, 722, 726
JFrame windows, 675–76
JLabel components, 649, 652, 729
Job application form, 729–34 JOptionPane class, 95–99, 631, 667–70 JPanel components, 682, 701, 714–15,
733
.jpg files, 182, 183, 185–86 JRadioButton components, 724–26 JSlider class, 736–38
JTextArea components, 719–20, 721 JTextField components, 653–54
K
Keywords, 60 Kludges, 530
L
Labels
check box, 722
on container regions, 703–4 JLabel, 649, 652
radio button, 725
Largest-number algorithms, 41–42 Late binding, 520
Layout managers
BorderLayout features, 698–704 defined, 650
embedded, 712–14, 729 FlowLayout features, 650, 696–98 GridLayout features, 704–7 overview, 695–96
tic-tac-toe application, 707–12 Leading whitespace, 92, 93