Please note that index links point to page beginnings from the print edition. Locations are approximate in e-readers, and you may need to page down one or more times after clicking a link to get to the indexed material.
&
Boolean logical AND, 77, 78, 79
and bounded type declarations, 347
&& (short-circuit AND), 77, 79
*
and glob syntax, 744
multiplication operator, 29, 63, 64
regular expression quantifier, 983
used in import statement, 196, 331
** (glob syntax), 744
@
used with tags (javadoc), 1228, 1232
|
character class specification, 983, 987
^
bitwise exclusive OR (XOR), 68, 69, 70–71
Boolean logical exclusive OR (XOR), 77, 78
character class specification, 983
: (used with a label), 106
::
constructor reference, 35, 402, 406
method reference, 35, 394, 400
{ }, 26, 28, 32, 35, 47, 48, 55, 58, 83, 84, 91, 95, 221, 296, 386, 410
used with javadoc tags, 1228
{…} anonymous inner class syntax, 799
$ used in temporary variable name, 1252
= = (Boolean logical operator), 77
= = (relational operator), 30, 76, 77, 268, 274
versus equals( ), 448–449
/* */, 26
//, 27
argument index syntax, 645–646
< >
diamond operator (type inference), 370–371
and generic type parameter, 338
<=, 76
format flag, 642
– > lambda expression arrow operator, 17, 63, 81, 380
%
used in format conversion specifier syntax, 633
used in a lambda expression, 380, 384, 385
used to raise the precedence of operations, 35, 43, 81, 444
. (period)
and calling static interface methods, 213
dot operator, 81, 113, 119, 148, 172, 196, 213
in import statement, 196
in multileveled package statement, 190, 196
and nested interfaces, 203
regular expression wildcard character, 983, 986
separator, 35
…
and enabling/disabling assertions syntax, 328–329
variable-length argument syntax, 35, 158, 161
+
concatenation operator, 29, 154–155, 443–444
regular expression quantifier, 983, 985–987
?
regular expression quantifier, 983, 986–987
wildcard argument specifier, 348, 351, 354, 368, 377, 744
?: (ternary if-then-else operator), 78, 80
>=, 76
; (semicolon), 28, 35, 92, 199
used in try-with-resources statement, 321, 678
~ (bitwise unary NOT operator), 68, 69, 70–71
and mnemonics specification, 1171
0 (zero) format flag, 642, 644
A
Abstract method(s), 183–186
and lambda expressions, 380, 381, 382, 383
abstract type modifier, 184, 187, 202, 381
Abstract Window Toolkit. See AWT (Abstract Window Toolkit)
AbstractAction interface, 1081, 1082
AbstractButton class, 1033, 1036, 1060, 1063, 1068, 1071
AbstractCollection class, 541, 543, 550
AbstractMap class, 568, 570, 572
AbstractSequentialList class, 541, 545
AbstractSet class, 541, 546, 548, 551
accept( ), 556, 664, 665, 666, 675, 676, 744, 764, 962, 975, 977
Access control, 143–146
example program, 193–196
and inheritance, 144, 146, 165–166
and modules, 144
and packages, 144, 189, 192–196
Access modifiers, 27, 144, 192–193
acquire( ), 908–911
Action (Swing), 1059, 1079–1084
Action interface, 1079, 1080, 1081
ActionEvent class, 772–773, 833, 857, 870, 1022, 1023, 1031, 1033, 1040
JavaFX, 1105, 1106, 1108, 1169
ActionListener interface, 783, 833, 837, 845, 870, 1022, 1023, 1033, 1040, 1067, 1079
actionPerformed( ), 783, 833, 836, 1023, 1024, 1033, 1040, 1067, 1068, 1079, 1081, 1082–1083
adapt( ), 952
add( ), 531, 532, 533, 534, 546, 553, 618, 805, 830, 836, 841, 844, 857, 861, 870, 975, 994, 995, 1019–1020, 1040, 1052, 1053, 1061, 1062, 1077, 1081, 1103, 1108, 1150, 1154, 1156, 1163, 1164, 1179
addActionListener( ), 1023
addAll( ), 531, 532, 533, 534, 975, 1104, 1108, 1150, 1163, 1164, 1169
addElement( ), 594
addEventFilter( ), 1105
addExports( ), 518
addFirst( ), 539, 540, 545, 975
addItem( ), 1050
addKeyListener( ), 771
addLast( ), 539, 540, 545, 546
addMouseListener( ), 789–790, 799, 1074
addMouseMotionListener( ), 771, 789–790
addOpens( ), 518
addReads( ), 518
Address, Internet, 750, 751–753, 757
addSeparator( ), 1062
addTab( ), 1042
addTListener( ) 1192
addUses( ), 518
AdjustmentEvent class, 773, 774, 848
AdjustmentListener interface, 783, 784, 848
adjustmentValueChanged( ), 783
Affine class, 1156
Algorithms, collection, 529, 581–586, 592
allMatch( ), 980
anchor constraint field, 865–866
AND operator
Boolean logical (&), 77, 78, 79
and bounded type declarations (&), 347
AnnotatedElement interface, 291, 293, 303, 526
Annotation interface, 285, 291, 525
Annotation member, 285
assigning a value to an, 285, 294, 295
default values for an, 292–293, 295
obtaining the value of an, 287, 288
Annotation(s), 15, 284–304, 525
built-in, 295–297
declaration example, 285
and JShell, 1251
marker, 293–294
member. See Annotation member
obtaining all, 290–291
reflection to obtain, using, 286–291
restrictions on, 304
retention policies, 285–286
single-member, 294–295
type, 297–302
annotationType( ), 285
anyMatch( ), 980
Apache Software Foundation, 1202
Apache Tomcat, 1202. See also Tomcat
API library, compact profiles of the, 334
APPEND, 494
Appendable interface, 523, 635, 693, 700, 707
appendTo( ), 494
Applet, 8–9
deprecated, 11, 18, 1235, 1255
Java Web Start with an, using, 1243
unsigned, 1236
versus Java Web Start, 1235–1236
Applet, AWT-based, 1255–1260
architecture, 1257
event-driven nature of the, 1257
and the Internet, 8–9
and main( ), 1256
and security, 1256
signed, 1256
skeleton, 1257–1260
as source and listener for events, 1257
Applet class, 804, 1235, 1255, 1257, 1260, 1262
Applet, Swing, 1015, 1016, 1021, 1255, 1260–1262
APPLET tag, HTML, 1256
AppletContext interface, 1255
AppletStub interface, 1255
Application class, 1097–1098, 1100
Application launcher (java). See java (Java application launcher)
apply( ), 407, 664, 665, 666, 963–964, 968
applyAsDouble( ), 664, 665, 666, 971
AreaAveragingScaleFilter class, 890
areFieldsSet Calendar class instance variable, 618
index, 645–646
lambda expressions passed as, 389–391
and overloaded constructors, 136
passing, 138–140
type. See Type argument(s)
variable-length. See Varargs
wildcard. See Wildcard arguments
Arithmetic operators, 63–68
ArithmeticException, 219, 220, 230, 507
boundary checks, 55
and collections, 587
constructor reference for, 406
converting collections into, 532, 543–544
copying with arraycopy( ), 495, 497–498
declaration syntax, alternative, 60
dynamic, 541–543, 550, 593–597
and the for-each loop, 99–103
and generics, 375–377
implemented as objects, 149
length instance variable of, 149–151
multidimensional, 56–60, 101–102
one-dimensional, 53–56
and spliterators, 590
and a stream API stream, 959
string using a byte, initializing a, 441
of strings, 156
and valueOf( ), 455
and varargs, 158
ArrayBlockingQueue class, 933
ArrayDeque class, 541, 550–551, 599
ArrayIndexOutOfBoundsException, 223, 230, 588
ArrayList class, 541–544, 560, 593, 594, 959
example using an, 554–555
examples using a stream API stream, 959–963, 968–972, 973–974, 976–979
arrive( ), 920–921
arriveAndAwaitAdvance( ), 920, 921, 923, 926
arriveAndDeregister( ), 921, 923
Arrow operator (–>), 17, 63, 81, 380
ASCII character set, 41, 42, 45, 450
and strings on the Internet, 441, 446
asIterator(), 593
asList( ), 587
Assertions, 326–329
AssertionError, 326
Assignment operator
arithmetic compound (op=), 63, 65–66
Boolean logical, 77
Atomic operations, 936–937
AttributeView interface, 728
AudioClip interface, 1255
Autoboxing/unboxing, 15, 277, 279–284, 339–340
Boolean and Character values, 282–283
and collections, 544
definition of, 279
and error prevention, 283–284
and expressions, 281–282
and methods, 280–281
Autocloseable interface, 314, 320, 524, 646, 653, 676, 678, 679, 682, 693, 696, 698, 699, 700, 707, 711, 713, 720, 729, 743, 754, 765, 956
Automatic resource management (ARM), 218, 319–322, 524, 646, 756
available( ), 680–682, 713, 714
availableProcessors( ), 948
await( ), 914, 915–916, 917, 935
awaitAdvance( ), 926
awaitAdvanceInterruptibly( ), 926
AWT (Abstract Window Toolkit), 305, 769, 786, 801–802, 829, 1095
classes, table of some, 802–804
color system, 815
controls. See Controls, AWT
and fonts, 819–825
layout managers. See Layout manager(s)
support for imaging, 879
support for text and graphics, 810
and Swing, 801, 829, 1011–1012
B
B, 4
Base64 class, 662
BaseStream interface, 956–957, 958, 965, 967
methods, table of, 956
BASIC, 4
Basic multilingual plane (BMP), 484
BasicFileAttributes class, 726, 727, 728, 741
methods, table of, 727
BasicFileAttributeView interface, 728
BCP 47, 626
BCPL, 4
BeanInfo interface, 1190, 1192–1193, 1194, 1196
naming convention for a class implementing the, 1192
Beans, Java. See Java Beans
Bell curve, 626
Bell Laboratories, 6
Berkeley UNIX, 749
Berners-Lee, Tim, 757
Beyond Photography: The Digital Darkroom (Holzmann), 886
BiConsumer functional interface, 664, 975
BiFunction functional interface, 664, 963
Binary
exponent, 45
literals, 44
numbers and integers, 68–69
BinaryOperator<T> predefined functional interface, 407, 664, 963
binarySearch( )
algorithm defined by Collections, 581
Arrays method, 587
BitSet class, 611–613
methods, table of, 611–612
Bitwise operators, 68–76
Block lambdas, 380, 385–387. See also Lambda expression(s)
BLOCKED, 264
Blocks of code. See Code blocks
Boolean, 37
literals, 45
logical operators, 77–79
and autoboxing/unboxing, 282–283
methods, table of, 487
boolean data type, 37, 42–43, 45, 50
and relational operators, 42, 43, 76–77
Border interface, 1028
BorderFactory class, 1028
BorderLayout class, 802, 856–858, 1023, 1078
example with insets, 858–859
BorderPane class, 1097, 1168, 1177
methods for positioning nodes within a, 1168
boxed( ), 958
Boxing, 279
break statement, 86, 87–88, 104–108
and the for-each loop, 100–101
as form of goto, 106–108
Buffer class, 718–720
methods, table of, 718–719
Buffer, NIO, 718–720
BufferedImage class, 881
BufferedInputStream class, 307, 688–690, 739
BufferedOutputStream class, 307, 688, 690, 739
BufferedReader class, 308, 309, 310–312, 704–706, 959
BufferedWriter class, 308, 706
Buffering, double, 882–885
build( ), 492
bulkRegister( ), 927
Button class
Button(s)
as event sources, 773, 782, 833, 1104, 1123, 1126
push. See Push buttons, AWT; Push buttons, JavaFX; Push buttons, Swing
radio. See Radio buttons
Swing, 1033–1041
Swing menu items as, 1060
toggle. See Toggle button, JavaFX; Toggle button, Swing
ButtonBase class, 1105, 1123, 1125, 1132
ButtonModel interface, 1014, 1033
ButtonUI, 1014
Byte class, 277, 278, 467, 473, 480, 481
methods defined by, table of, 474
and automatic type conversion, 50
and automatic type promotion, 52, 71–72, 74–75
ByteArrayInputStream class, 307, 685–686
ByteArrayOutputStream class, 307, 686–688
ByteBuffer class, 719, 728, 729, 733
get( ) and put( ) methods, table of, 720
Bytecode, 10–11, 13–14, 18, 26, 326, 333, 509
byteValue( ), 278, 468, 470, 471, 474, 475, 476, 478
C
history of, 4–5
C Programming Language, The (Kernighan and Ritchie), 4
C++
history of, 5–6
C# and Java, 8
Calendar class, 616, 617, 618–621, 622, 626, 1001
constants, 620
methods defined by, table of a sampling of, 618–620
Call-by-reference, 138, 139–140
Callable interface, 907, 929–932, 952
CallSite class, 525
canRead( ), 518
canUse( ), 518
Canvas class
JavaFX, 1109–1113
capacityIncrement Vector data member, 594
Card layouts, 861–864
CardLayout class, 802, 861–864
CaretEvent class, 1031–1032
Case sensitivity and Java, 25, 27, 34, 190
case statement, 86–91
Casts, 50–52, 336, 339, 340, 342
and casting one instance of a generic class into another, 368
using instanceof with, 323–325
catch clause(s), 217, 218, 220–224, 226, 227–228, 236
displaying exception description within, 222
and the more precise (final) rethrow feature, 235, 236
multi-catch feature of, 235–236
using multiple, 222–223
and nested try statements, 221, 224
CGI (Common Gateway Interface), 11, 1201–1202
ChangeListener interface, 1128–1129
Channel interface, 720
Channel(s), NIO, 718, 720–721. See also NIO and channel-based I/O
char data type, 37, 41–42, 44, 68, 441
and arithmetic operators, 63
and automatic type conversion, 50
and automatic type promotion, 52
Character class, 277, 467, 482–485
and autoboxing/unboxing, 282–283
methods, table of various, 483, 486
support for 32-bit Unicode, 484–485
basic multilingual plane (BMP), 484
changing case of, 455–456, 482, 483
classes (regular expressions), 983, 987
code point, 484
extraction from String objects, 445–446
formatting an individual, 635
literals, 45
supplemental, 484
Character.Subset class, 484
Character.UnicodeBlock class, 484
CharArrayReader class, 308, 702–703
CharArrayWriter class, 308, 703–704
CharBuffer class, 719
CharSequence interface, 439, 456, 461, 522, 982
methods defined by, table of, 522
Check boxes
as event sources, 773, 777, 782, 838, 1104, 1132, 1135
indeterminate state of, enabling the, 1132, 1135
JavaFX, 1132–1136
Swing, 1038–1039
and Swing menus, 1071, 1072–1073
Checkbox class
CheckboxGroup class, 802, 839–841
CheckboxMenuItem class, 802, 869, 870
checked… methods, 581–582, 585
checkedCollection( ), 581, 585
CheckMenuItem class, 1162, 1173
Choice controls, 782, 830, 841–847
as event source, 773, 777, 782
ChoiceBox control, 1144
Class class, 286–287, 288, 290, 291, 338, 424–425, 485, 501–504, 727, 990, 992
methods, table of some, 502–503
.class filename extension, 26
CLASS retention policy, 285–286
access levels of, 192–193
anonymous, 17. See also Inner classes
character, regular expression, 983, 987
in collections, storing user-defined, 558–560
constructor. See Constructor
controlling access to. See Access control
as a data type, 111, 113, 115, 116, 117, 128
definition of the term, 21
encapsulation achieved through, 21, 128
final, 187
general form of, 111–112
generic. See Generic class
inner. See Inner classes
instance of a, 21, 111, 113, 116
and interfaces, 189, 198, 200–203, 359
JShell to experiment with, using, 1250
member. See Member, class
name and source file name, 25, 26
nested, 151–153
packages as containers for, 189, 192, 196
path, 418
public, 193
scope defined by a, 48
and state information, 210, 213
synthetic, 1246, 1248, 1249, 1250
type for bounded types, using a, 345–347
value-based, 614
ClassCastException, 230, 532, 533, 536, 538, 540, 561, 564, 565, 573, 585, 587, 589, 590
ClassDefinition class, 525
ClassFileTransformer interface, 525
ClassLoader class, 505
classModifiers( ), 993
ClassNotFoundException, 231, 713
–classpath option, 191
ClassValue class, 522
clear( ), 531, 532, 562, 601, 611, 619, 718, 1156
Client/server model, 8–9, 11, 749
and sockets, 753–756
clone( ), 187, 499–501, 521, 594, 601, 611, 617, 619, 623, 1216
Cloneable interface, 499–501
CloneNotSupportedException, 231, 499, 521
Cloning
and enumerations, 521
potential dangers of, 500, 501
close( ), 314, 316–318, 319, 320, 321, 322, 524, 633, 646, 648, 653, 657, 676, 677, 678, 680, 681, 684, 685, 686, 696, 697, 699, 700, 702, 703, 711, 712, 713, 714, 729, 754, 756, 765, 956
within a finally block, calling, 316–319, 677
Closeable interface, 314, 320, 653, 676, 679, 682, 693, 696, 698, 699, 700, 707, 720
Closures, 379
COBOL, 4
Code blocks, 30, 32–33, 47, 84–85
and the break statement, 106–108
static, 147
Code point, definition of, 484
Code
snippet, 1245, 1247, 1248, 1250, 1253
codePointAt( ), 457, 464, 485, 486
codePointBefore( ), 457, 464, 486
Collection interface, 530–533, 538, 543, 561, 959, 961, 965
methods defined by, table of, 531–532
Collection-view, 529, 560, 561, 602
into arrays, converting, 532, 543–544
and autoboxing, 544
cycling through, 529, 551–558, 597
dynamically typesafe view of a, 585
and the for-each version of the for loop, 99, 103, 555–556, 597
Framework. See Collections Framework
and iterators, 529, 533, 551–555, 556–558
and legacy classes and interfaces, 592–608
modifiable versus unmodifiable, 530
random access to, 560
storing user-defined classes in, 558–560
and the stream API, 608, 955, 956, 959, 961, 974
stream API stream to obtain a, using a, 972–975
and synchronization, 540, 585, 592
and type safety, 585
when to use, 608
Collections class, 400, 529, 585, 592
algorithms defined by, table of, 581–585
Collections Framework, 14, 99, 103, 279, 527–608, 934
advantages of generics as applied to the, 335
legacy classes and interfaces, 592–608
and method references, 400–402
overview, 528–529
Collector interface, 972
Collectors class, 972
Color class, AWT, 802, 807–808, 815–817
constants to specify colors, list of, 808
methods to manipulate colors, 815–816
Color class, JavaFX, 1111, 1156
Color, working with, 815–817
Combo box, JavaFX, 1141–1144
enabling users to edit a, 1141, 1143–1144
Combo boxes, Swing, 1049–1051
ComboBox class, 1141
ComboBoxBase class, 1141
ComboBoxModel interface, 1050
documentation, 34–35, 1227–1234
Common Gateway interface (CGI), 11, 1201–1202
Compact profiles, 334
Comparable interface, 356, 359, 449, 522–523, 617, 673
Comparable<Path> interface, 722
Comparator interface, 401, 402, 530, 565, 570, 573, 961
Comparators, 548, 549, 550, 570, 571, 572–580
using a lambda expression with, 576–577, 580
compare( ), 401–402, 470, 471, 474, 475, 476, 478, 487, 573, 575–576, 591, 961
compareTo( ), 273–275, 449–450, 470, 471, 474, 475, 476, 478, 484, 487, 521, 522, 576, 617, 673
compareToIgnoreCase( ), 450
compareToIgnoreOptional( ), 492
compareUnsigned( ), 591
comparing( ), 574–575
comparingByKey( ), 565
comparingByValue( ), 565
comparingDouble( ), 575
comparingInt( ), 575
comparingLong( ), 575
Compilation unit, 25
compile( ), 982
Compiler
ahead-of-time, 11
Compiler class, 509
Compiler, Java, 25–26
and main( ), 27
Component class, 771, 782, 802, 804–805, 807, 808, 809, 810, 822, 830, 855, 878, 880, 1014, 1015, 1018, 1020, 1024, 1025, 1061, 1257, 1258, 1259
ComponentAdapter class, 795
componentAdded( ), 784
ComponentEvent class, 773, 774–775, 776, 782
componentHidden( ), 784
ComponentListener interface, 783, 784, 795
componentMoved( ), 784
componentRemoved( ), 784
componentResized( ), 784
Components, AWT, 1011–1012, 1014
lightweight versus heavyweight, 878
and overriding paint( ), 878
Components and Java Beans, software, 1189
Components, Swing, 1014–1015, 1029–1057
architecture, 1013–1014
class names for, table of, 1014–1015
and the Swing event dispatching thread, 1020
heavyweight, 1015
painting, 1024–1028
and pluggable look and feel, 1012–1013, 1014
and tabbed panes, 1042–1044
componentShown( ), 784
ComponentUI, 1014
compute( ), 940, 945, 949, 951, 954
concat( ), 453
Concurrency utilities, 15, 905–954
versus traditional multithreading and synchronization, 905, 954
Concurrent API, 905–906
packages, 906–907
Concurrent collection classes, 906, 933–934
list of, 933
Concurrent program, definition of the term, 905
ConcurrentHashMap class, 907, 933
ConcurrentLinkedDeque, 933
ConcurrentLinkedQueue class, 907, 933
ConcurrentSkipListMap class, 933
ConcurrentSkipListSet class, 933
Condition class, 935
connect( ), 754
Console class, 708–710
methods, table of, 709
Console I/O, 28, 95, 305, 309–313, 708–710
const keyword, 36
Constants, 34
using an interface to define shared, 206–208
Constructor class, 287, 290, 291, 526, 990
Constructor reference, 402–406
for an array, 406
to generic classes, 403–406
in class hierarchy, order of execution of, 176–177
enumeration, 271–273
factory methods versus overloaded, 751
generic, 357
object parameters for, 137–138
overloading, 134–136
parameterized, 125–126
reference. See Constructor reference(s)
and super( ), 169–172, 176, 333
this( ) and overloaded, 331–333
constructorModifiers( ), 993
Consumer<T> predefined functional interface, 407, 523, 556, 664, 962, 977
Container class, 802, 805, 807, 830, 855, 857, 858, 1014, 1015, 1019, 1025, 1061, 1257
Container, JavaFX, 1096–1097
Container(s), Swing, 1014, 1015
lightweight versus heavyweight, 1015
panes, 1015–1016. See also Content pane
ContainerAdapter class, 795
ContainerEvent class, 773, 775
ContainerListener interface, 783, 784, 795
Containment hierarchy, 1014, 1015
contains( ), 457, 531, 532, 546, 594, 601
Content pane, 1015, 1016, 1019–1020, 1028, 1042, 1045, 1053, 1056, 1062, 1067
adding a component to a, 1019–1020
default layout manager of a JFrame, 1019, 1022–1023
ContentDisplay enumeration, 1119–1120, 1123
Context switching, 237, 253, 266
rules for, 239
ContextMenu class, 1162–1163, 1175–1176, 1178
ContextMenuEvent class, 1178
CONTINUE, 746
continue statement, 108–109
Control class, 1097, 1102, 1105, 1160
Control statements. See Statements, control
action events, using an anonymous inner class or lambda expression to handle, 836–837
adding, 830
definition of an, 829
removing, 830
responding to, 830–831
Control(s), JavaFX, 1097, 1102, 1104, 1115–1160, 1186
adding an image to a, 1115, 1118–1123
adding a tooltip to a, 1160
disabling, 1160
and effects and transforms, 1154–1160. See also Effects; Transforms
and event handling, 1102–1109
text, 1144–1146
convert( ), 933
ConvolveOp built-in convolution filter, 901
Convolution filters, 893, 899, 901
Cookie class, 1212, 1214–1215, 1220, 1222
methods, table of, 1216
CookieHandler class, 763
CookieManager class, 763
CookiePolicy interface, 763
example servlet using, 1220–1222
CookieStore interface, 763
copyOfRange( ), 588
CopyOnWriteArrayList class, 907, 933
CopyOnWriteArraySet class, 933
countDown( ), 914–915
CountDownLatch class, 906, 908, 913–915
CountedCompleter class, 939
countStackFrames( ), 512
createImage( ), 880, 885, 886, 890
createLineBorder( ), 1028
CropImageFilter class, 890–892
Currency class, 631–632
methods, table of, 631
currentTimeMillis( ), 495, 497
CustomMenuItem class, 1162
CyclicBarrier class, 906, 908, 915–917, 920
D
Data types, 29. See also Type(s); Types, primitive
DatagramPacket class, 764, 765–766
methods, list of some, 766
server/client example, 766–767
DatagramSocket class, 721, 764–765, 767
DataInput interface, 696, 697, 698, 713
DataInputStream class, 307, 696, 668–698
DataOutput interface, 696, 698, 669, 711
DataOutputStream class, 307, 696–698
Date and time. See Time and date; Time and date API
methods, table of, 617
DateFormat class, 616, 626, 997–999, 1004
DateTimeFormatter class, 1003–1006
Decoder class, 662
Decrement operator (– –), 32, 63, 66–67
deepEquals( ), 588–589
deepHashCode( ), 591
deepToString( ), 591
default
clause for annotation member, 292–293
to declare a default interface method, using, 210
statement, 86–87
DefaultMutableTreeNode class, 1052, 1053
defaults Properties instance variable, 603
DelayQueue class, 933
Delegation event model, 770–771
and Beans, 1192
and event listeners, 770, 771, 783–786
and event sources, 770–771, 782–783
and JavaFX, 1105
and Swing, 1021
using, 786–794
delete operator, 127
deleteCharAt( ), 462–463
deleteOnExit( ), 673
delimiter( ), 656
Delimiters, 609–610
@Deprecated built-in annotation, 295, 297
Deque interface, 530, 539–540, 545, 550
methods, table of, 539–540
descendingIterator( ), 537, 539, 540
destroy( ), 488, 491, 512, 513
and applets, 1235, 1257, 1259, 1260
and servlets, 1202, 1205, 1207
Dialog boxes, 874–878
Dialog windows, 1091
Diamond operator (<>), 370–371
Dictionary class, 528, 592, 599–600
abstract methods, table of, 599
digit( ), 484
Dimension class, 802, 806, 813
reflection example using the, 990–991
Directories as File objects, 671, 673–674
creating, 676
Directories and packages, file system, 190
Directory, listing the contents of a
using list( ), 673–675
using listFiles( ), 675–676
using NIO, 742–745
Directory tree, obtaining a list of files in a, 746–748
DirectoryStream<Path> class, 742, 743
DirectoryStream.Filter interface, 744
DISCARD, 494
dispose( ), 874
distinct( ), 980
do-while loop, 92–95
Document interface, 1031
@Documented built-in annotation, 295, 296
Domain Naming Service (DNS), 750
doPut( ), 1217
DosFileAttributes class, 726, 727, 742
DosFileAttributeView interface, 728
Dot operator (.), 81, 113, 119, 148, 172, 196, 213
doTrace( ), 1217
Double buffering, 882–885
Double class, 277, 278, 468–473, 480
methods, table of, 471–472
double data type, 37, 40–41, 44
and automatic type conversion, 50
and automatic type promotion, 52–53
DoubleAccumulator class, 937
DoubleAdder class, 937
DoubleBinaryOperator functional interface, 590
DoubleBuffer class, 719
doubles( ), 628
DoubleStream interface, 958, 959
DoubleSummaryStatistics class, 662
doubleValue( ), 278, 345, 468, 470, 471, 474, 475, 476, 478
drawArc( ), 811
drawOval( ), 811
drawPolygon( ), 811–812
drawRoundRect( ), 811
drawString( ), 790, 807, 808, 825, 826, 1256
Duration class, 1007
Dynamic method
dispatch, 180–183
lookup, 201
resolution, 198, 201, 202, 206
E
E (Math constant), 505
Early binding, 186
echoCharIsSet( ), 851
Edit control, 850
Effect class, 1155
Effects, 1155–1156
list of some built-in, 1155
program demonstrating, 1157–1160
element( ), 538
elementAt( ), 594
elementCount Vector data member, 594
elementData Vector data member, 594
elements( ), 594, 599, 600, 601
ElementType enumeration, 296, 525
ElementType.FIELD, 301
ElementType.METHOD, 301
ElementType.TYPE_USE, 298, 301
else, 83–86
EMPTY_LIST static variable, 585
EMPTY_MAP static variable, 585
EMPTY_SET static variable, 585
Encapsulation, 5, 20–21, 22, 24–25, 128, 169
and access control, 143
and scope rules, 48
Encoder class, 662
end( ), 982–983
ensureCapacity( ), 459, 543, 594
entrySet( ), 561, 562, 565, 569, 602
methods, table of, 521
Enumeration interface, 592–593, 595–597, 600, 609, 610, 692
Enumeration(s), 15, 267–276, 521
= = relational operator and, 268, 244
as a class type in Java, 267, 271–273
constants, 267, 268, 269, 270, 271, 272, 273
constructor, 271–273
and JShell, 1251
restrictions, 273
values in switch statements, using, 268–270
variable, declaring an, 268
factory methods, table of, 552
Environment properties, list of, 498
equals( ), 155, 187, 188, 274–275, 285, 447, 469, 470, 471, 474, 475, 476, 478, 484, 487, 492, 499, 520, 521, 531, 533, 562, 567, 573, 576, 588, 600, 611, 614, 617, 619, 752, 820
versus = =, 448–449
equalsIgnoreCase( ), 447
equalsIgnoreOptional( ), 492
and ambiguity errors, 373–374
bridge methods and, 372–373
err, 308, 495. See also System.err
Error class, 218, 219, 227, 234, 708
Errors
ambiguity, 373–374
assertions to check for, using, 326–328
autoboxing/unboxing and prevention of, 283–284
automatic type promotions and compile-time, 52
compile-time versus run-time, 342
generics and prevention of, 340–342
raw types and run-time, 362
run-time, 13, 217, 323. See also Exception handling
Event
bubbling, 1105
change, 1128–1129, 1137, 1141, 1154
definition of an, 770
design patterns for a Java Bean, 1192
dispatch chain, 1105
dispatching thread and Swing, 1020, 1024, 1060
filter, 1105
model, delegation. See Delegation event model
multicasting and unicasting, 771, 1192
timestamp, 773
Event class, 1105
Event handling, 769–799
and adapter classes, 794–796
event classes for, 771–782
and immediate and quick event processing, 771, 786, 808, 1024, 1106
and inner classes, 153, 796–799, 836, 837
keyboard, 790–794
and lambda expressions, 836–837, 1023–1024
and Swing, 772, 1012, 1021–1024
See also Delegation event model
Event listener interfaces, 783–786
and adapter classes, 794–796
table of commonly used, 783
EventHandler interface, 1105, 1108, 1109
EventListener interface, 662
EventListenerProxy class, 662
EventObject class, 662, 772, 1105
EventSetDescriptor class, 1192, 1194, 1196
Exception class, 218, 219, 231, 233, 234
Exception classes
and generics, 377
hierarchy of the built-in, 218–219
Exception handling, 13, 95, 104, 217–236, 316, 317–319
block, general form of, 218
and chained exceptions, 15, 234–235
and creating custom exceptions, 231–233
and the default exception handler, 219–220, 226
and lambdas, 392–393
and the more precise (final) rethrow feature, 235, 236
multi-catch, 235–236
and suppressed exceptions, 232, 322
and uncaught exceptions, 219–220, 524
Exception Site List, 1237, 1239, 1242, 1243
Exception(s)
definition of the term, 217
and JShell, 1253
Exceptions, built-in, 230–231
checked, table of, 231
run-time, constructors for, 227
unchecked, table of, 230
Exceptions, I/O, 677
Exchanger class, 906, 908, 917–919
Execution point, 520
ExecutorService interface, 907, 927, 928, 930
exit( ). See System.exit( )
exports statement, 410, 414, 416
and qualified export, 418–419
Expression lambda, 385. See also Lambda expression(s)
Expressions
and autoboxing/unboxing, 281–282
automatic type promotion in, 52–53
JShell to evaluate, using, 1251–1252
regular. See Regular expressions
extends, 163, 165, 208, 345, 350, 363
and bounded wildcard arguments, 351, 354
Externalizable interface, 711, 1193
F
false, 36, 42, 43, 45, 77, 78, 79, 125
FALSE, 485
FAT file system, 726, 728, 742
Field class, 287, 290, 291, 526, 990
Field, final, 148–149
fieldModifiers( ), 993
fields array (Calendar class), 618
File attribute(s)
File to access, using, 671–676, 740
interfaces, 726–728
NIO to access, using, 727–728, 740–742
view interfaces, 728
File class, 647, 671–676, 679, 683, 694, 698, 700, 708, 740
instance into a Path instance, converting a, 673, 722, 740
File system directories and packages, 190
file( ), 494
File(s)
to a buffer, map a, 721, 732–733, 736–737
close( ) to close a, using, 314, 316–318, 319, 322, 684
I/O, 313–322, 671–676. See also NIO; NIO and channel-based I/O
path to a, obtaining a, 722, 725–726, 729
pointer, 698
system, accessing the, 728
try-with-resources to automatically close a, using, 314, 319–322, 684
FileChannel class, 721, 729, 732, 733, 734, 736
FileDialog class, 802
FileFilter interface, 676
FileInputStream class, 307, 313–314, 679–682, 721
FilenameFilter interface, 674–675, 676
FileNotFoundException, 314, 317, 677, 679, 683, 700
FileOutputStream class, 307, 313–314, 318, 682–685, 721
FileReader class, 308, 647, 700
Files class, 671, 721, 723–725, 727, 728, 737, 738, 740, 741, 742, 746
methods, table of a sampling of, 724–725
FileStore class, 728
FileSystem class, 728
FileSystems class, 728
FileVisitor interface, 746–747
FileVisitResult enumeration, 746
FileWriter class, 308, 701–702
fill( )
algorithm defined by Collections, 582
Arrays method, 589
fillArc( ), 811
fillPolygon( ), 811–812
fillRoundRect( ), 811
fillText( ), 1110
filter( ), 614, 616, 957, 958, 962–963, 970
FilteredImageSource class, 885, 890
FilterInputStream class, 307, 688, 696
FilterOutputStream class, 307, 688, 696
FilterReader class, 308
FilterWriter class, 308
to prevent class inheritance, 187
to prevent method overriding, 186
finally block, 217, 218, 228–229, 316–317, 677
findAll( ), 657
findInLine( ), 656–657
findWithinHorizon( ), 657
Finger protocol, 757
fire( ), 1126, 1128, 1129, 1165
firstElement( ), 594
firstKey( ), 565
flatMapToDouble( ), 972
flatMapToInt( ), 972
flatMapToLong( ), 972
Float class, 277, 278, 468–471, 472–473, 480
methods, table of, 470–471
and type promotion, 52–53
literals, 44–45
strictfp and, 325
FloatBuffer class, 719
floatValue( ), 278, 468, 470, 471, 474, 475, 476, 478
Flow class, 907
Flow subsystem to control data flow, 907
Flow.Processor interface, 907
Flow.Publisher interface, 907
Flow.Subscriber interface, 907
Flow.Subscription interface, 907
FlowLayout class, 803, 832, 854, 855–856, 1022–1023
FlowPane class, 1097, 1100–1101, 1108–1109, 1177
flush( ), 633, 676, 681, 690, 700, 709, 711, 712
Flushable interface, 676, 679, 682, 693, 696, 700, 707, 708
FocusAdapter class, 795
FocusEvent class, 773, 775–776
FocusEvent.Cause enumeration, 776
focusGained( ), 784
FocusListener interface, 783, 784, 795
focusLost( ), 784
Font class, AWT, 803, 820, 821, 822, 824
methods, table of some, 820
Font class, JavaFX, 1110
Font(s), 819–825
creating and selecting, 822–824
determining available, 821–822
information, obtaining, 824–825
metrics to manage text output, using, 825–828
terminology used to describe, 825
FontMetrics class, 803, 825–828
methods, table of some, 826
enhanced. See For-each version of the for loop
variations, 98–99
For-each version of the for loop, 15, 95, 99–103
and arrays, 99–103
and the break statement, 100–101
and collections, 99, 103, 530, 555–556
general form, 99
and the Iterable interface, 523, 530, 555
and maps, 560
forceTermination( ), 927
forDigit( ), 484
forEach( ), 523, 553, 957, 958, 962, 967
forEachOrdered( ), 967
forEachRemaining( ), 552, 553, 556–558, 978
Fork/Join Framework, 16–17, 239, 266, 663, 905–906, 907, 927, 938–954
advantages to using the, 938, 954
classes, main, 938–942
tips for using the, 954
Fork/Join Framework divide-and-conquer strategy, 940, 942–945, 954
and the sequential processing threshold interaction with the level of parallelism, 945–948
Fork/Join Framework tasks, 939
asynchronous execution of, 951
cancelling, 951
completion status of, 952
and the parallelism level, 941, 954
restarting, 952
tags, 953
that do not return a result, 940, 944, 948
that return a result, 940, 948–951
fork( ), 939, 941, 945, 949, 950, 952
ForkJoinPool class, 907, 927, 938, 939, 940–942, 943, 944, 945, 948, 951, 953–954
common pool, 940, 941, 945, 948, 954
ForkJoinTask class, 907, 938, 939, 940, 941, 944, 945, 951, 952–953, 954
ForkJoinTask<T> class, 942
Format flags, 642–644
Format specifiers (conversions), 632, 633–646
argument index with, using an, 645–646
and format flags, 642–644
and specifying minimum field width, 639–640
and specifying precision, 641
suffixes for the time and date, table of, 637–638
table of, 634
uppercase versions of, 644–645
format( ), 457, 633–635, 645, 695, 696, 708, 709, 998, 1003
FormatStyle enumeration, 1004
Formattable interface, 662
FormattableFlags class, 662
Formatted input, using Scanner to read, 647–657
Formatter class, 632–647, 694, 695
closing an instance of the, 646–647
constructors, 632–633
methods, table of, 633
See also Format specifiers
Forward reference, 1249
Frame class, 782, 783, 787, 789, 803, 804, 805, 807, 856
Frame window(s), 805–810
and creating a Frame-based application, 809–810
default layout manager for, 856
methods used to work with a, 806–808
requesting repainting of a, 808–809
Frank, Ed, 6
FTP (File Transfer Protocol), 750, 757
Function<T,R> predefined functional interface, 407, 574, 644, 968
Functional interfaces, 17, 297, 379, 380, 381–382, 384, 837
and their abstract methods, table of, 664–666
generic, 387–389
and lambda expressions passed as arguments, 389–391
predefined, 406–407
and public Object methods, 380
@FunctionalInterface built-in annotation, 295, 297
Future interface, 907, 930–932
FXCollections class, 1136, 1141
FXML, 1096
G
Garbage collection, 13, 127, 141, 487–488, 525, 1202
Generic class
and casting, 368
definition of the term, 336
example program with one type parameter, 336–340
example program with two type parameters, 343–344
general form of a, 344
hierarchies, 362–370
and instanceof, 366–368
overriding methods in a, 369–370
and raw types, 360–362
and type inference, 370–371
Generic constructors, 357
Generic interfaces, 336, 358–360
and classes, 359
Generic method, 336, 348, 354–357, 375
and annotations, 304
and ambiguity errors, 373–374
and arrays, 375–377
and the Collections Framework, 335
and compatibility with pre-generics code, 360–362, 371
and exception classes, 377
restrictions when using, 375–377
type checking and safety, 339, 340–342, 361, 377
GenericServlet class, 1205, 1207, 1210, 1215
get( ), 533, 534, 546, 561, 562, 568, 599, 600, 601, 611, 614, 615, 619, 666, 725–726, 729, 731, 733, 763, 930, 932–933, 937, 961, 962, 975
getActionCommand( ), 773, 833, 845, 1034, 1040, 1068
getActiveThreadCount( ), 953
getAddListenerMethod( ), 1196
getAdjustable( ), 774
getAdjustmentType( ), 774, 848
getAlignment( ), 831
getAllFonts( ), 821
getAnnotation( ), 287, 291, 302–303, 502, 517, 519
getAnnotations( ), 290–291, 502, 517
getAnnotationsByType( ), 291, 303, 502, 517
getArrivedParties( ), 927
getAsDouble( ), 616
getAsInt( ), 616
getAsLong( ), 616
getAttribute( ), 1208, 1209, 1215, 1222
getAttributeNames( ), 1215, 1222
getAvailableFontFamilyNames( ), 821
getBackground( ), 808
getBeanInfo( ), 1196
getBlue( ), 816
getButton(), 780
getByAddress( ), 752
getCause( ), 232, 234–235, 776
getChannel( ), 721
getChars( ), 445–446, 460, 701
getChild( ), 775
getChildren( ), 1102–1103, 1150, 1151
getClass( ), 187, 188, 286–287, 338, 499, 501, 504, 992
getClassLoader( ), 519
getClickCount( ), 779
getColor( ), 816
getCommonPoolParallelism( ), 948
getComponent( ), 775, 1074, 1075, 1076
getContainer( ), 775
getContentPane( ), 1019–1020
getContents( ), 660
getContentType( ), 759
getDate( ), 759
getDateInstance( ), 997–998
getDateTimeInstance( ), 999
getDeclaredAnnotation( ), 291, 517
getDeclaredAnnotations( ), 291, 502, 517, 519
getDeclaredAnnotationsByType( ), 291, 303, 502, 518
getDeclaredMethods( ), 503, 992
getDescriptor( ), 519
getDirectionality( ), 484
getDisplayCountry( ), 625
getDisplayLanguage( ), 625
getEchoChar( ), 851
getEventSetDescriptors( ), 1192, 1199
GetField inner class, 713–714
getFileAttributeView( ), 728
getFont( ), 820, 824, 826, 1110
getForeground( ), 808
getForkJoinTaskTag( ), 953
getFreeSpace( ), 673
getGraphicsContext2D( ), 1110
getGreen( ), 816
getHeaderField( ), 759
getHostAddress( ), 753
getHostName( ), 753
getHour( ), 1006
getHvalue( ), 1148
getIcon( ), 1030
getID( ) AWTEvent class method, 772
getInitParameter( ), 1208
getInitParameterNames( ), 1208
getInputStream( ), 488, 492, 754, 759
getInsets( ), 814, 858, 1025–1026
getISOCountries( ), 626
getItem( ), 777, 842, 845, 870, 1036, 1038
getItemSelectable( ), 778, 845
getKeyChar( ), 778
getKeyCode( ), 778
getKeyStroke( ), 1069
getLabel( ), 833, 837, 869–870
getLayer( ), 519
getListenerType( ), 1196
getLocalGraphicsEnvironment( ), 821
getLocationOnScreen( ), 780
getLogger( ), 495
getMaximum( ), 848
getMenuComponentCount( ), 1063
getMenuComponents( ), 1063
getMenuCount( ), 1061
getMenus( ), 1163
getMethod( ), 287, 289, 503, 1196, 1213
getMethodDescriptors( ), 1192
getMinimum( ), 848
getMinimumSize( ), 855
getModifiers( ), 773, 777, 992
getModifiersEx( ), 777
getMonth( ), 1006
getN( ) getter method design pattern, 1190, 1191
getName( ), 240, 242, 338, 503, 511, 513, 518, 519, 671, 722, 723, 740, 820, 992, 1196, 1216, 1221
getNewState( ), 782
getObjectInputFilter( ), 714
getOldState( ), 782
getOppositeComponent( ), 776
getOppositeWindow( ), 782
getOutputStream( ), 488, 492, 754, 1209
getPackages( ), 519
getParallelism( ), 948
getParameter( ), 1209, 1211, 1218, 1219
getParameterNames( ), 1209, 1211
getParent( ), 513, 671, 723, 740, 927, 1151
getPoint( ), 779
getPoolSize( ), 953
getPreciseWheelRotation( ), 781
getPreferredSize( ), 855
getProperty( ), 496, 498, 604–605
getPropertyDescriptors( ), 1192, 1193, 1198, 1199
getQueuedTaskCount( ), 952
getRed( ), 816
getRegisteredParties( ), 927
getRemoveListenerMethod( ), 1196
getResourceAsStream( ), 519
getRGB( ), 816
getScreenX( ), 1178
getScreenY( ), 1178
getScript( ), 626
getScrollAmount( ), 781
getScrollType( ), 781
getSecurityManager( ), 496, 519
getSelectedCheckbox( ), 840
getSelectedIndex( ), 842, 844, 1047
getSelectedIndexes( ), 845
getSelectedItem( ), 842, 844, 1050
getSelectedItems( ), 845, 1140
getSelectedText( ), 850–851, 853
getSelectedToggle( ), 1132
getSelectedValue( ), 1047
getSelectionModel( ), 1137, 1150
getServletConfig( ), 1207
getServletContext( ), 1208
getServletInfo( ), 1207
getServletName( ), 1208
getSource( ), 772, 835, 1040, 1105
getStackTrace( ), 232, 511, 520
getState( ), 264–265, 511, 837, 870
getSubElements( ), 1062
getSurplusQueuedTaskCount( ), 952–953
getTarget( ), 1170
getText( ), 831, 850, 853, 1030, 1032, 1033, 1038, 1144, 1170
getTimeInstance( ), 998–999
getTransforms( ), 1156
getUnarrivedParties( ), 927
getTotalSpace( ), 673
getUsableSpace( ), 673
getValue( ), 567, 569, 774, 847, 1080–1081, 1141–1142, 1151, 1216, 1221
getVvalue( ), 1148
getWheelRotation( ), 780–781
getWhen( ), 773
getWidth( ), 1026
getWindow( ), 782
getXOnScreen( ), 780, 1074, 1076
getY( ), 779
getYear( ), 1006
getYOnScreen( ), 780
GIF image format, 879–880
Glassfish, 1202
Glob, 744
Glow class, 1155
program demonstrating, 1157–1160
Gosling, James, 6
goto keyword, 35
Goto statement, using labeled break as form of, 106–108
Graphical User Interface. See GUI (Graphical User Interface)
Graphics
and JavaFX retained mode, 1109
sizing, 813–815
Graphics class, 790, 803, 807, 810, 816, 824, 881, 882
drawing methods, 810–813
Graphics2D class, 810
GraphicsContext class, 1109–1113
GraphicsEnvironment class, 803, 821
Greedy behavior (regular expression pattern matching), 986, 987
GregorianCalendar class, 618, 621–623, 626, 1001
Grid bag layouts, 864–869
GridBagConstraints class, 803, 864–866
constraint fields, table of, 865
GridBagLayout class, 803, 865, 866, 869
gridheight constraint field, 865, 866
GridLayout class, 803, 860–861
GridPane class, 1097
gridwidth constraint field, 865, 866
Group class, 1097
group( ) Matcher class method, 982
GIU (Graphical User Interface), 305, 801, 829
approaches to the, 1095
effects and transforms to customize the look of a JavaFX, using, 1154–1160
frameworks, Java’s three, 786–787
programs, handling events generated by, 769–799, 808
GZIP file format, 667
H
hasCharacteristics( ), 557, 558
hashCode( ), 187, 285, 470, 471, 474, 475, 476, 478, 484, 487, 499, 518, 520, 521, 531, 562, 567, 591, 600, 611, 614, 617, 820
HashMap class, 568–570, 571, 572, 600
HashSet class, 541, 546–547, 568, 959
from a stream API stream, obtaining a, 975
Hashtable class, 541, 591, 600–603
and iterators, 602–603
legacy methods, table of, 601
hasMoreTokens( ), 610
hasNext( ), 552, 553, 556, 976, 977
hasNextX( ) Scanner methods, 648, 651
table of, 649
HBox layout, 1186
Headers, 759
as character values, 45
and string literals, 46
Hierarchical abstraction and classification, 20
High surrogate char, 485
Histogram, 888–889
Hoare, C.A.R., 240
Holzmann, Gerard J., 886
HotSpot technology,10
HSB (hue-saturation-brightness) color model, 815
HSBtoRGB( ), 816
HTML (Hypertext Markup Language), 1201, 1205
file for an applet, 1256
file for a JavaFX application, 1101, 1102
HTMLEditor, 1146
GET requests, handling, 1217–1218
and HttpURLConnection class, 761
port, 750
POST requests, handling, 1217, 1219–1220
requests, 1201, 1202, 1212–1213, 1217
response, 1201, 1202, 1205, 1212–1213, 1214
and URLConnection class, 759
HTTP session
stateful, 763
tracking, 1222–1223
HttpCookie class, 763
HttpServlet class, 1212, 1215, 1217
methods, table of, 1216–1217
HttpServletRequest interface, 1212, 1218, 1219, 1222
methods, table of several, 1213
HttpServletResponse interface, 1212–1213, 1214
methods, table of, 1214
HttpSession interface, 1212, 1213, 1222
methods, table of several, 1215
HttpURLConnection class, 761–763
methods, sampling of, 761
I
Icon interface, 1030
Icons
Swing label, 1030
Identifiers, 26, 34, 36, 46, 47
IdentityHashMap class, 568, 572
if statement, 30–31, 32, 42, 43, 83–86
Boolean object used to control the, 283
boolean variable used to control the, 84, 283
nested, 85
and recursive methods, 142
switch statement versus, 90–91
if-else-if ladder, 85–86
IllegalAccessException, 227, 231
IllegalArgumentException, 230, 532, 533, 536, 538, 540, 551, 561, 564, 565, 588
IllegalFormatException, 635
IllegalStateException, 230, 532, 538, 540, 982, 983, 1213
Image class
AWT, 803, 879, 880, 881, 882, 885, 887
JavaFX, 1115–1117
ImageConsumer interface, 887–889, 890
ImageIcon class, 1029, 1030, 1078
ImageIO class, 880
Image observer, 881
ImageObserver interface, 881
ImageProducer interface, 880, 885, 887, 890
Images (AWT), 879–904
creating, loading, displaying, 880–882
double buffering and, 882–885
file formats for web, 879–880
filters for, 890–904
stream model for, 890
Imaging, 879
ImageView class, 1115–1117, 1118, 1120
implements clause, 200
and generic interfaces, 359, 360
import statement, 196–197, 1253
and static import, 329–331
in, 308, 492, 495, 647, 708. See also System.in
Increment operator (++), 32, 63, 66–68
indexOf( ), 450–452, 464–465, 533, 534, 594
IndexOutOfBoundsException, 230, 533
Inet4Address class, 753
Inet6Address class, 753
InetAddress class, 751–753, 764
InetSocketAddress class, 765
infinity (IEEE floating-point specification value), 472
inForkJoinPool( ), 952
INHERIT, 494
InheritableThreadLocal class, 517
Inheritance, 5, 20, 21–22, 24–25, 144, 146, 163–187
and annotations, 304
and enumerations, 273
final and, 186–187
and interfaces, 189, 198, 208–209, 212–213, 214
multilevel, 173–176
and multiple superclasses, 165, 189
@Inherited built-in annotation, 295, 296
init( )
and applets, 1235, 1257, 1259, 1260, 1262
and JavaFX, 1097, 1098, 1100, 1102
and servlets, 1202, 1205, 1207
Inline method calls, 186
Inner classes, 151–153, 796–799
anonymous, 153, 798–799, 836, 837, 926, 1023, 1040, 1061, 1075–1076, 1105, 1109, 1162, 1169
InnerShadow class, 1155–1156
program demonstrating, 1157–1160
InputEvent class, 773, 776–777, 778, 779, 1069
InputMismatchException, 651
InputStream class, 306, 307, 309, 647, 678, 679, 680, 685, 688, 689, 691, 692, 696, 713, 716, 738, 1210
methods, table of, 680
objects, concatenating, 692
InputStreamReader class, 308, 309
insertSeparator( ), 1062
Insets
definition of the term, 813–814
example program, 858–859
Insets class, 803, 814, 858–859, 1025
Instance of a class, 21, 111, 113, 116. See also Object(s)
Instance variables
default values of, 125
definition of the term, 21, 112
hiding, 127
and interfaces, 210
static, 147–148
transient, 323
as unique to their object, 113, 114–115
using super to access hidden, 172–173
instanceof operator, 63, 323–325, 560
and generic classes, 366–368
Instrumentation interface, 525
and automatic type conversion, 50
and automatic type promotion, 52–53, 71–72, 74–75
and integer literals, 43
IntBuffer class, 719
Integer class, 277, 278, 279, 282, 467, 473, 480–481, 961
constructors, 278
methods, table of, 476–478
and annotations, 285
Interface methods
default, 17, 18, 199, 209–213, 379, 381
extension, 209
functional. See Functional interfaces
general form of, 199
generic. See Generic interfaces
implementing, 200–202
inheritance hierarchy, 198
and JShell, 1250–1251
member, 202
methods. See Interface methods
nested, 202–203
reference variables, 200–202, 206
and state information, 210, 213
types for bounded types, using, 347
interfaceModifiers( ), 993
Internet, 3, 6, 7, 8, 9, 14, 18, 749
addresses, obtaining, 752–753
addressing scheme, 750
Internet Engineering Task Force (IETF) BCP 47, 626
Internet of Things (IoT), 409
Internet Protocol (IP)
addresses, 750
definition of the term, 749
InterruptedException, 231, 241–242, 888
Introspection, 1190–1193, 1196, 1198–1199
Introspector class, 1195, 1196
ints( ), 628
IntStream interface, 958, 959, 971
IntSummaryStatistics class, 662
intValue( ), 278, 279, 468, 470, 471, 474, 475, 476, 479
InvalidPathException, 725
invoke( ), 939, 941, 945, 951, 953
invokeAll( ), 939, 945, 949, 952
invokeAndWait( ), 1020, 1021, 1262
channel-based, 15, 306, 717. See also NIO; NIO and channel-based I/O
classes, list of, 670
console, 28, 95, 305, 309–313, 708–710
error handling, 316–319
exceptions, 677
formatted. See I/O, formatted
interfaces, list of, 670
and Java’s GUI frameworks, 305
new. See NIO
redirection, 494
streams. See Streams, I/O
I/O, formatted, 15
format specifiers. See Format specifiers
using Formatter, 632–647. See also Formatter class
using Scanner, 647–657. See also Scanner class
io package. See java.io package
IOError, 709
IOException, 95, 309, 314, 317, 318, 677, 679, 680, 684, 691, 699, 700, 701, 707, 712, 713, 723, 742, 746, 754, 758, 764
ipadx constraint field, 865, 866
ipady constraint field, 865, 866
IPv4 (Internet Protocol, version 4), 750, 751, 752, 753
IPv6 (Internet Protocol, version 6), 750, 751, 752, 753
isAlive( ), 240, 248–250, 486, 488, 511
isAltDown( ), 777
isAltGraphDown( ), 777
isAnnotationPresent( ), 291, 293, 518
isClosed( ), 754
isCompletedAbnormally( ), 952
isCompletedNormally( ), 952
isConstrained( ), 1196
isControlDown( ), 777
isDirectory( ), 673–674, 724, 727
isEmpty( ), 457, 531, 532, 562, 595, 599, 600, 601, 612
isExported( ), 519
isFile( ), 672
isHidden( ), 673, 724, 726, 728, 740
isIndeterminate( ), 1135
isLeapYear( ), 622
isLightweight( ), 878
isMetaDown( ), 777
isMulticastAddress( ), 753
isNamed( ), 519
ISO-Latin-1 character set, 41, 45
isOpen( ), 519
isPopupTrigger( ), 779, 1074, 1076
isPropertyName( ), 1191
isPublic( ), 992
isQuiescent( ), 953
isSelected( ), 1036, 1038, 1040, 1062, 1124, 1125, 1135
isSet array (Calendar class), 618
isShiftDown( ), 777
isShutdown( ), 954
isTemporary( ), 776
isTerminated( ), 954
isTimeSet (Calendar class instance variable), 618
ItemEvent class, 773, 777–778, 838, 842, 845, 870, 1036, 1038
ItemListener interface, 783, 784, 837, 838, 842, 870, 1036, 1038
ItemSelectable interface, 778
itemStateChanged( ), 784, 838, 842, 1036, 1038
Iterable interface, 457, 523, 530, 555, 560, 593
Iterable<Path> interface, 722, 743
Iteration statements, 83, 91–102
Iterator interface, 529, 530, 551, 553–555, 556, 592, 593, 976, 977
methods, table of, 552
iterator( ), 523, 531, 533, 553, 743, 956, 976
Iterator(s), 529, 533, 551–555, 556–558
and maps, 560
obtaining an, 553
and primitive types, 529
and PriorityQueue, 550
and stream API streams, 976–979
and synchronized collections, 585
J
J2SE 5, new features of, 15
JApplet class, 1015, 1235, 1255, 1260, 1262
JAR files. See Java Archive (JAR) files
jarsigner command-line tool, 1237, 1241
Java
applications and Java Web Start, web-based deployment of, 1235
and C#, 8
design features (buzzwords), 12–14
and the Internet, 3, 6, 7–10, 14, 18, 749
as an interpreted language, 10, 13
keywords. See Keywords
look and feels, 1013
as a strongly typed language, 13, 37, 43
versions of, 14–18
Java Archive (JAR) files, 436, 663, 1098, 1102
and Java Web Start, 1235, 1236–1237, 1238, 1239, 1240
manifest, 1240
modular, 435
signing, 1236–1237, 1240–1241, 1242, 1243
Java Beans, 504, 526, 981, 990, 1189–1199
advantages of, 1190
API, 1194–1196
customizers, 1193
definition of the term, 1189
demonstration program, 1196–1199
events, design pattern for, 1192
introspection, 1190–1193, 1196, 1198–1199
persistence, 1193
properties. See Property, Java Bean
serialization, 1193
.java filename extension, 25
Java Community Process (JCP), 18
Java Control Panel, 1237, 1239, 1242
Java Foundation Classes (JFC), 1012
java (Java application launcher), 26, 27, 191, 314, 436, 1102
and main( ), 27
Java Native Interface (JNI), 326
Java Network Launch Protocol (JNLP). See JNLP (Java Network Launch Protocol) files
Java Runtime Environment (JRE), 417
Java SE 7, 16–17
Java SE 8, 17
Java SE 9, 17–18
Java Virtual Machine (JVM), 10, 11, 13, 14, 18, 26, 27, 487, 510, 525
Java Web Start, 11, 18, 1235–1243, 1255
application signing, 1235, 1236–1237, 1240–1241, 1242, 1243
example using the local file system, 1239
and JAR files, 1235, 1236–1237, 1238, 1239, 1240
and JNLP files, 1235, 1236, 1237–1239, 1240, 1241–1242, 1243
and javaws, 1243
versus applets, 1235–1236
with an applet, using, 1243
java.applet package, 1255
java.awt package, 769, 772, 802, 880, 1022
classes, tables of some, 802–804
java.awt.Dimension class, reflection example using the, 990–991
java.awt.event package, 769, 771, 772, 783, 794, 1021, 1022
adapter classes, table of commonly used, 795
event classes, table of commonly used, 773
interfaces, table of commonly used, 783
java.awt.event.InputEvent class. See InputEvent class
java.awt.event.KeyEvent class. See KeyEvent class
java.awt.image package, 879, 885, 890, 901, 904
java.base module, 417, 467, 524, 527, 663, 717, 751, 769, 802, 906, 956, 981, 990, 997, 1002
java.beans package, 1192, 1194–1196
classes, table of, 1194–1195
interfaces, table of, 1194
java.desktop module, 417, 769, 880, 1016, 1194, 1255
java.instrument module, 525
java.io package, 305, 306–308, 314, 320, 669–670, 676, 717, 740
automatically imported by JShell, 1252–1253
classes, list of, 670. See also Streams, byte; Streams, character
interfaces, list of, 670
java.io.Externalizable interface, 711, 1193
java.io.IOException. See IOException
java.io.Serializable interface, 1193. See also Serializable interface
java.lang package, 197, 230, 286, 295, 308, 314, 320, 356, 359, 417, 439, 467–526, 676
classes and interfaces, list of, 467
implicit importation of the, 197, 467
subpackages, 524–526
java.lang.annotation package, 285, 295, 302, 524, 525
java.lang.annotation.RententionPolicy enumeration, 285, 525
java.lang.image package, 887
java.lang.instrument package, 524, 525
java.lang.invoke package, 524, 525
java.lang.management package, 524, 525
java.lang.module, 519, 524, 525
java.lang.ref package, 525
java.lang.reflect package, 286, 291, 525–526, 981, 990
classes, table of, 990
java.management module, 525
classes and interfaces, list of, 750–751
java.nio package, 306, 669, 717, 718
java.nio.channels package, 717, 720, 722
java.nio.channels.spi package, 717
java.nio.charset package, 717, 722
java.nio.charset.spi package, 717
java.nio.file package, 673, 717, 722
java.nio.file.attribute package, 717, 722, 726
java.nio.file.spi package, 717, 722
java.nio.file.WatchService, 748
java.prefs module, 666
java.rmi module, 994
java.time package, 618, 981, 1001, 1002, 1007
java.time.format package, 1001, 1003, 1004
java.time.temporal.ChronoUnits, 933
java.util package, 424, 527–528, 592, 609, 769, 772, 961, 976
automatically imported by JShell, 1252
classes, list of top-level, 527–528
interfaces defined by, list of, 528
subpackages, 663–667
java.util.concurrent package, 663, 906–907, 932, 938
java.util.concurrent.atomic package, 663, 906, 907, 936, 937
java.util.concurrent.locks package, 663, 906, 907, 934, 935, 936
java.util.function package, 17, 407, 523, 556, 574, 590, 609, 663, 962, 963, 968, 975
functional interfaces defined by, table of, 664–666
java.util.jar package, 663
java.util.List class. See List class (java.util)
java.util.logging package, 663, 666
java.util.prefs package, 663, 666
java.util.regex package, 663, 667, 981
java.util.spi package, 663, 667
java.util.stream package, 17, 663, 667, 956, 972, 980
java.util.zip package, 663, 667
java.xml module, 417
JAVA_HOME environmental variable, 434
javac (Java compiler), 25–26, 191, 298, 362, 1102, 1246, 1248
and modules, 409, 410, 414–415, 436
and multi-module compilation mode, 419
tags, 1227–1232
JavaFX, 17, 305, 786, 787, 801, 829, 1095–1113
and automatic rendering, 1096, 1109–1113
controls. See Control(s), JavaFX
event handling, 1102, 1104–1109
images, support for, 1115–1117
and Java Web Start, 1235, 1239
launcher thread, 1102
layout panes, 1097, 1100, 1101, 1108–1109, 1168, 1177, 1186
menus. See Menus, JavaFX
nodes. See Node(s), JavaFX
packages, 1096
scene, 1096, 1097, 1100, 1101, 1102, 1177
scene graph, 1097, 1100, 1102–1104, 1108, 1109, 1113, 1116, 1117, 1147, 1154, 1162, 1164, 1165, 1178, 1179, 1186
stage, 1096, 1097, 1100, 1101, 1102
versus Swing, 1095, 1096, 1109
JavaFX application
class, 1097–1098
compiling and running a, 1101–1102
launching a, 1098
life-cycle methods, 1097–1098, 1100
modular, 1098
skeleton, 1098–1101
thread, 1102
javafx.application package, 1096, 1097, 1100
javafx.base module, 1096
javafx.beans.value package, 1129
javafx.collections package, 1103, 1136
javafx.controls module, 1096
javafx.event package, 1105, 1106
javafx.geometry package, 1109
javafx.graphics module, 1096, 1098
javafx.scene package, 1096, 1100
javafx.scene.canvas package, 1109
javafx.scene.control package, 1102, 1105, 1115, 1126, 1132, 1161
javafx.scene.effect package, 1155, 1186
javafx.scene.image package, 1115
javafx.scene.input package, 1171
javafx.scene.layout package, 1096, 1097, 1100
javafx.scene.paint package, 1111
javafx.scene.paint.Color class, 1111, 1156
javafx.scene.shape package, 1113
javafx.scene.text package, 1110, 1160
javafx.scene.transform package, 1156, 1186
javafx.stage package, 1096, 1100
javafx.stage.PopupWindow, 1175
javafxpackager tool, 1098, 1102
javap, 373
javaws tool, 1243
javax.imageio package, 880, 904
javax.servlet package, 1205, 1206–1210, 1212
interfaces and classes, list of core, 1206–1207
javax.servlet.http package, 1206, 1212–1217
interfaces and classes, list of some, 1212
javax.swing package, 1014, 1016, 1018, 1019, 1029, 1052
classes, list of, 1014–1015
javax.swing.event package, 1021, 1032, 1047, 1052
javax.swing.table package, 1055
javax.swing.tree package, 1052
JButton class, 1015, 1023, 1029, 1033–1035, 1060, 1063, 1081
JCheckBox class, 1029, 1033, 1036, 1038–1039, 1081
JCheckBoxMenuItem class, 1060, 1071, 1072–1073, 1081
JComboBox class, 1029, 1049–1051
JComponent class, 1014, 1015, 1024, 1025, 1029, 1033, 1061, 1071, 1260
JFormattedTextField class, 1091
JFrame class, 1015, 1016–1017, 1018, 1019–1020, 1028, 1260
adding a menu bar to a, 1062, 1064, 1067
content pane layout manager, 1019, 1022–1023
JIT (Just-In-Time) compiler, 10, 14
JLabel class, 1015, 1016, 1017, 1019, 1021, 1024, 1029–1031, 1067
JLayeredPane class, 1015
JMenu class, 1060, 1061, 1062–1063, 1064
mnemonic, 1068
JMenuBar class, 1060, 1061–1062, 1064
JMenuItem class, 1060, 1061, 1062, 1063, 1064, 1071, 1072
action to create a, using an, 1081
and action events, 1063, 1064, 1067, 1068
JNLP (Java Network Launch Protocol) files
and Java Web Start, 1235, 1236, 1237–1239, 1240, 1241–1242, 1243
and JavaFX applications, 1101, 1102
join( ), 240, 248–250, 456–457, 511, 933, 939, 949, 950, 953
JOptionPane class, 1091
Joy, Bill, 6
JPanel class, 1015, 1016, 1026, 1028, 1042, 1044
JPEG image file format, 879
JPopupMenu class, 1060, 1073–1076, 1081
and mouse events, 1074, 1075–1076
JRadioButton class, 1029, 1033, 1036, 1039–1041, 1081
JRadioButtonMenuItem class, 1060, 1072–1073, 1081
JRootPane class, 1015
JScrollBar class, 1015
JScrollPane class, 1029, 1044–1046, 1047, 1052, 1053, 1055
jshell, 1245
and state information, 1245, 1247
JSpinner class, 1091
JTabbedPane class, 1029, 1042–1044
JTextCompenent class, 1031
JTextField class, 1029, 1031–1033
JToggleButton class, 1029, 1033, 1035–1037, 1039
JToggleButton.ToggleButtonModel class, 1036
JToolbar class, 1060, 1077–1079
adding an action to a, 1081
Just In Time (JIT) compiler, 10, 14
JVM (Java Virtual Machine), 11, 13, 14, 18, 26, 27, 487, 510, 525
JWindow class, 1015
3.145.78.136