J

J# programming language, 8

J++ programming language, 8

delegates in, 280

JApplet class, 803808

Jar Bundler utility, 783

JAR files, 190, 780787

creating, 780

digitally signed, 822824

dropping in jre/lib/ext directory, 193

executable, 782783

manifest of, 781782

resources and, 783787

sealing, 787

jar program, 780

command-line options of, 781782

Java programming language

architecture-neutral object file format of, 5

as a programming platform, 12

available under GPL, 14

basic syntax of, 4246, 145

calling by value in, 165

case-sensitiveness of, 26, 42, 5356, 528

communicating with JavaScript, 809

compiling/launching from the command line, 24

design of, 28

documentation for, 23

dynamic, 8

dynamic binding in, 209, 214217

garbage collection in, 68, 139

history of, 1012

interpreter in, 7

libraries in, 1213

installing, 2223

misconceptions about, 1315

multithreading in, 7, 839952

networking capabilities of, 4

no multiple inheritance in, 297

no operator overloading in, 109

no unsigned types in, 48

performance of, 7, 14, 534

portability of, 6, 13, 56

reliability of, 4

reserved words in, 43, 53, 56

security of, 45, 14, 820822

simplicity of, 3, 315

strongly typed, 47, 291

versions of, 1112, 538, 700

vs. C++, 3

Java 2 (J2), 18

Java 2D library, 560569

floating-point coordinates in, 561

Java bug parade, 44, 393

Java collections framework (JCF), 459536

algorithms in, 517528

converting between collections and arrays in, 525526

interfaces in, 469471

legacy classes in, 528536

operations in:

bulk, 524525

optional, 514

separating interfaces from implementations in, 460463

views and wrappers in, 509517

vs. traditional collections libraries, 465

Java Concurrency in Practice (Goetz), 840

Java Development Kit (JDK), 5, 1739

applet viewer, 805806

documentation in, 7477, 612

downloading, 1820

fonts shipped with, 574

installation of, 1823

default, 780

setting up, 2022

.java file extension, 43

Java Language Specification, 43

Java look-and-feel, 611

Java Memory Model and Thread Specification, 885

Java Network Launch Protocol (JNLP), 824838

Java Plug-in, 802824

control panel of, 827

enabling, 34

installing, 803

Java console in, 807

restrictiveness of, 9, 822

running local applets in, 806

signed code in, 822824

java program, 25

command-line options of, 385386

Java Runtime Environment (JRE), 18

Java SE 8, 12, 18

adding static methods to interfaces in, 298299, 523

completable futures in, 931

concurrent hash maps in, 906911

constructor expressions in, 433

hash tables in, 486

Java Plug-in for, 34

lambda expressions in, 314329, 464, 887

LongAdder, LongAccumulator classes in, 888

parallelized operations on arrays in, 912

Java virtual machine (JVM), 6

generics in, 425, 452458

launching, 25

monitoring and managing applications in, 412

optimizing execution in, 391

precomputing method tables in, 216

security vulnerabilities in, 803

thread priority levels in, 859

truncating arithmetic computations in, 56

watching class loading in, 411

Java Virtual Machine Specification, 44

Java Web Start, 824838

launching, 826

printing in, 832

security of, 829

java.applet.Applet API, 807808, 816817, 820

java.applet.AppletContext API, 820

java.awt.BorderLayout API, 644

java.awt.Color API, 572

java.awt.Component API, 552, 559, 573, 624, 651, 724

java.awt.Container API, 595, 641

java.awt.event.ActionEvent API, 598

java.awt.event.InputEvent API, 623

java.awt.event.MouseEvent API, 623, 686

java.awt.event.WindowEvent API, 607

java.awt.event.WindowListener API, 606

java.awt.event.WindowStateListener API, 607

java.awt.EventQueue API, 943

java.awt.FlowLayout API, 641

java.awt.Font API, 580581

java.awt.font.LineMetrics API, 581

java.awt.FontMetrics API, 582

java.awt.Frame API, 553

java.awt.geom.Ellipse2D.Double API, 569

java.awt.geom.Line2D.Double API, 569

java.awt.geom.Point2D.Double API, 569

java.awt.geom.Rectangle2D.Double API, 568

java.awt.geom.Rectangle2D.Float API, 569

java.awt.geom.RectangularShape API, 568

java.awt.Graphics API, 572, 581, 585586

java.awt.Graphics2D API, 573, 582

java.awt.GraphicsEnvironment API, 778

java.awt.GridLayout API, 648

java.awt.LayoutManager API, 728

java.awt.Robot API, 778

java.awt.Toolkit API, 305, 553, 623

java.awt.Window API, 552, 560

java.beans.EventHandler API, 598

java.io.Console API, 81

java.io.PrintWriter API, 89

java.lang.Boolean API, 237

java.lang.Byte API, 237

java.lang.Character API, 237

java.lang.Class API, 244, 265, 270, 275, 451, 457, 787

java.lang.ClassLoader API, 388

java.lang.Comparable API, 293

java.lang.Double API, 237, 294

java.lang.Enum API, 260

java.lang.Exception API, 380

java.lang.Float API, 237

java.lang.Integer API, 237, 255256, 294

java.lang.Long API, 237

java.lang.Object API, 132, 237, 244, 489, 881882

java.lang.Objects API, 237

java.lang.reflect package, 265, 276

java.lang.reflect.AccessibleObject API, 275

java.lang.reflect.Array API, 279

java.lang.reflect.Constructor API, 265, 270, 452

java.lang.reflect.Field API, 270, 276

java.lang.reflect.GenericArrayType API, 458

java.lang.reflect.InvocationHandler API, 355

java.lang.reflect.Method API, 270, 283, 457

java.lang.reflect.Modifier API, 271

java.lang.reflect.ParameterizedType API, 458

java.lang.reflect.Proxy API, 356

java.lang.reflect.TypeVariable API, 457

java.lang.reflect.WildcardType API, 458

java.lang.Runnable API, 851

java.lang.RuntimeException API, 380

java.lang.Short API, 237

java.lang.StackTraceElement API, 380381

java.lang.String API, 7273

java.lang.StringBuilder API, 78

java.lang.System API, 81, 509, 793

java.lang.Thread API, 846, 851, 854, 858861

java.lang.Thread.UncaughtExceptionHandler API, 861

java.lang.ThreadGroup API, 862

java.lang.ThreadLocal API, 893

java.lang.Throwable API, 265, 366, 379380

java.math.BigDecimal API, 111

java.math.BigInteger API, 110

java.nio.file.Paths API, 89

java.text.NumberFormat API, 256

java.time.LocalDate API, 145

java.util.ArrayDeque API, 495

java.util.ArrayList API, 247, 251

java.util.Arrays API, 119120, 234, 238, 294, 516

java.util.BitSet API, 533

java.util.Collection API, 468469, 524

java.util.Collections API, 514515, 520524, 915

java.util.Comparator API, 521

java.util.concurrent package, 868

canned functionality classes in, 934937

efficient collections in, 905907

java.util.concurrent.ArrayBlockingQueue API, 903

java.util.concurrent.atomic package, 886

java.util.concurrent.BlockingDeque API, 904905

java.util.concurrent.BlockingQueue API, 904

java.util.concurrent.Callable API, 919

java.util.concurrent.ConcurrentHashMap API, 907

java.util.concurrent.ConcurrentLinkedQueue API, 907

java.util.concurrent.ConcurrentSkipListMap API, 907

java.util.concurrent.ConcurrentSkipListSet API, 907

java.util.concurrent.Delayed API, 903

java.util.concurrent.DelayQueue API, 903

java.util.concurrent.ExecutorCompletionService API, 928

java.util.concurrent.Executors API, 925926

java.util.concurrent.ExecutorService API, 925, 928

java.util.concurrent.Future API, 919920

java.util.concurrent.FutureTask API, 920

java.util.concurrent.LinkedBlockingQueue API, 903

java.util.concurrent.locks.Condition API, 877, 895

java.util.concurrent.locks.Lock API, 871, 877, 894

java.util.concurrent.locks.ReentrantLock API, 872

java.util.concurrent.locks.ReentrantReadWriteLock API, 896

java.util.concurrent.PriorityBlockingQueue API, 904

java.util.concurrent.ScheduledExecutorService API, 926

java.util.concurrent.ThreadLocalRandom API, 893

java.util.concurrent.ThreadPoolExecutor API, 926

java.util.concurrent.TransferQueue API, 905

java.util.Deque API, 494495

java.util.Enumeration API, 530

java.util.EnumMap API, 508

java.util.EnumSet API, 508

java.util.EventObject API, 598

java.util.function API, 319

java.util.HashMap API, 500

java.util.HashSet API, 488

java.util.Hashtable API, 530

java.util.IdentityHashMap API, 509

java.util.Iterator API, 469

java.util.LinkedHashMap API, 508

java.util.LinkedHashSet API, 507

java.util.LinkedList API, 484

java.util.List API, 482483, 516, 521, 524

java.util.ListIterator API, 483

java.util.logging.ConsoleHandler API, 407

java.util.logging.FileHandler API, 407

java.util.logging.Filter API, 408

java.util.logging.Formatter API, 408

java.util.logging.Handler API, 406

java.util.logging.Logger API, 404406

java.util.logging.LogRecord API, 407408

java.util.Map API, 499, 501503

java.util.Map.Entry API, 503

java.util.NavigableMap API, 517

java.util.NavigableSet API, 493, 516

java.util.Objects API, 235

java.util.prefs.Preferences API, 799800

java.util.PriorityQueue API, 496

java.util.Properties API, 531, 792793

java.util.Queue API, 494

java.util.Random API, 181

java.util.Scanner API, 81, 89

java.util.ServiceLoader API, 802

java.util.SortedMap API, 500, 516

java.util.SortedSet API, 493, 516

java.util.Stack API, 532

java.util.TreeMap API, 500

java.util.TreeSet API, 493

java.util.Vector API, 530

java.util.WeakHashMap API, 507

JavaBeans, 260, 758, 813

javac program, 25

current directory in, 192

javadoc program, 194199

command-line options of, 199

comments in:

class, 194198

extracting, 198199

field, 194, 196

general, 196

method, 194195, 198

overview, 198

package, 194, 198

redeclaring Object methods for, 318

HTML markup in, 194

hyperlinks in, 198

links to other files in, 195

online documentation of, 199

JavaFX, 543

javap program, 336

JavaScript, 15

accessing applets from, 810

communicating with Java, 809

javaws program, 828

javaws.jar file, 830

javax.jnlp.BasicService API, 836

javax.jnlp.FileContents API, 837

javax.jnlp.FileOpenService API, 837

javax.jnlp.FileSaveService API, 837

javax.jnlp.PersistenceService API, 837838

javax.jnlp.ServiceManager API, 836

javax.swing package, 545

javax.swing.AbstractAction API, 683

javax.swing.AbstractButton API, 663, 681684, 688

javax.swing.Action API, 615

javax.swing.border.LineBorder API, 668

javax.swing.border.SoftBevelBorder API, 667

javax.swing.BorderFactory API, 666667

javax.swing.ButtonGroup API, 663

javax.swing.ButtonModel API, 663

javax.swing.event package, 627

javax.swing.event.MenuListener API, 690

javax.swing.filechooser.FileFilter API, 764

javax.swing.filechooser.FileNameExtensionFilter API, 764

javax.swing.filechooser.FileView API, 764

javax.swing.GroupLayout API, 722

javax.swing.GroupLayout.Group API, 723

javax.swing.GroupLayout.ParallelGroup API, 723

javax.swing.GroupLayout.SequentialGroup API, 723

javax.swing.ImageIcon API, 554

javax.swing.JButton API, 595, 752

javax.swing.JCheckBox API, 659

javax.swing.JCheckBoxMenuItem API, 684

javax.swing.JColorChooser API, 770

javax.swing.JComboBox API, 671

javax.swing.JComponent API, 560, 582, 615, 650, 668, 686, 699, 752

javax.swing.JDialog API, 745

javax.swing.JFileChooser API, 762763

javax.swing.JFrame API, 559, 682

javax.swing.JLabel API, 652

javax.swing.JMenu API, 681

javax.swing.JMenuItem API, 681682, 688, 690

javax.swing.JOptionPane API, 304, 739741

javax.swing.JPasswordField API, 653

javax.swing.JPopupMenu API, 685

javax.swing.JRadioButton API, 663

javax.swing.JRadioButtonMenuItem API, 684

javax.swing.JRootPane API, 752

javax.swing.JScrollPane API, 656

javax.swing.JSlider API, 678

javax.swing.JTextArea API, 656

javax.swing.JTextField API, 650

javax.swing.JToolBar API, 699

javax.swing.KeyStroke API, 615

javax.swing.SwingUtilities API, 752

javax.swing.SwingWorker API, 950

javax.swing.text.JTextComponent API, 648

javax.swing.Timer API, 305

javax.swing.UIManager API, 602

javax.swing.UIManager.LookAndFeelInfo API, 603

JButton class, 591, 595, 610, 636638

isDefaultButton method, 752

JCheckBox class, 657659

isSelected method, 658659

setSelected method, 657, 659

JCheckBoxMenuItem class, 683684

JColorChooser class, 764770

methods of, 770

JComboBox class, 627, 668671

addItem method, 669671

getItemAt method, 669

getSelectedItem method, 669671

insertItemAt method, 669, 671

isEditable method, 671

removeXxx methods, 669, 671

setEditable method, 669, 671

setModel method, 669

JComponent class, 554

action maps, 612

get/setComponentPopupMenu methods, 685686

get/setInheritsPopupMenu methods, 685686

getActionMap method, 615

getFontMetrics method, 577, 582

getInputMap method, 612, 615

getRootPane method, 748, 752

input maps, 611613

paintComponent method, 554556, 560, 577, 583

repaint method, 951

revalidate method, 649650, 951

setBorder method, 664, 668

setDebugGraphicsOptions method, 771

setFont method, 650

setSelectionStart/End methods, 952

setToolTipText method, 699

jconsole program, 393, 412, 771, 889

jcontrol program, 807

JDialog class, 741745

setDefaultCloseOperation method, 743, 807

setVisible method, 743, 746, 807

JDK. See Java Development Kit

JEditorPane class, 654

JFC (Java Foundation Classes), 539

JFileChooser class, 752764

addChoosableFileFilter method, 763

getSelectedFile/Files methods, 754, 763

resetChoosableFilters method, 756, 763

setAcceptAllFileFilterUsed method, 756, 763

setAccessory method, 763

setCurrentDirectory method, 754, 762

setFileFilter method, 755, 763

setFileSelectionMode method, 754, 763

setFileView method, 756757, 763

setMultiSelectionEnabled method, 754, 763

setSelectedFile/Files methods, 754, 763

showDialog, showXxxDialog methods, 747, 752, 754, 763

JFrame class, 543547, 640

add method, 555, 559

getContentPane method, 559

internal structure of, 554555

setJMenuBar method, 679, 682

JLabel class, 651652, 757

getIcon, getText methods, 652

setIcon, setText methods, 651652

JList class, 670

jmap program, 413

JMenu class

add, addSeparator methods, 679, 681

insert, insertSeparator methods, 681

remove method, 681

JMenuBar class, 679682

JMenuItem class, 681682

setAccelerator method, 687688

setEnabled method, 689690

setIcon method, 682

Jmol applet, 9

JNLP API, 829838

compiling programs with, 830

join method (Thread), 73, 856858

JOptionPane class, 730741

message types, 731

showConfirmDialog method, 731732, 739

showInputDialog method, 731732, 740

showInternalConfirmDialog method, 739

showInternalInputDialog method, 741

showInternalMessageDialog method, 739

showInternalOptionDialog method, 740

showMessageDialog method, 304, 731732, 739

showOptionDialog method, 731732, 739740

JPanel class, 558, 638, 842

JPasswordField class, 652653

getPassword, setEchoChar methods, 653

JPopupMenu class, 684686

isPopupTrigger, show methods, 685

JRadioButton class, 660663

JRadioButtonMenuItem class, 684

JRootPane class, setDefaultButton method, 748, 752

JScrollbar class, 627

JScrollPane class, 656

JSlider class, 672678

setInverted method, 674, 678

setLabelTable method, 429, 673, 678

setPaintLabels method, 673, 678

setPaintTicks method, 673, 678

setPaintTrack method, 674, 678

setSnapToTicks method, 673, 678

setXxxTickSpacing methods, 678

JTextArea class, 653654

append method, 656, 951

insert method, 951

replaceRange method, 951

setColumns, setRows methods, 654, 656

setLineWrap method, 654, 656

setTabSize method, 656

setWrapStyleWord method, 656

JTextComponent class

getText method, 650

is/setEditable methods, 648

setText method, 648, 650, 951

JTextField class, 627, 649651

getColumns method, 650

setColumns method, 649650

JToolBar class, 695696

add, addSeparator methods, 695699

JUnit framework, 410

Just-in-time compiler, 67, 14, 153, 218, 413, 534

JVM. See Java virtual machine

K

K type variable, 419

Key/value pairs. See Properties

KeyAdapter class, 626

Keyboard

associating with actions, 610

focus of, 611

mnemonics for, 686688

Keyboard focus, 729

KeyEvent class, 626

getKeyXxx, isActionKey methods, 627

KeyListener interface, 626

keyXxx methods, 627

keyPress/Release methods (Robot), 778

keys method

of Hashtable, 530

of Preferences, 795, 799

keySet method

of ConcurrentHashMap, 912

of Map, 502503

KeyStroke class, getKeyStroke method, 610, 615

Knuth, Donald, 106

KOI-8 standard, 51

L

L suffix (long integers), 48

Labeled break statement, 106

Labels

for components, 651652

for slider ticks, 673

Lambda expressions, 314329

accessing variables in, 322324

atomic updates with, 887

capturing values by, 323

for event listeners, 595

functional interfaces and, 318

method references and, 320

no assigning to a variable of type Object, 319

parameter types of, 316

processing, 324328

result type of, 316

scope of, 324

syntax of, 315317

this keyword in, 324

vs. inner classes, 318

lambda/LambdaTest.java, 317

Langer, Angelika, 458

last method (SortedSet), 493

lastIndexOf method

of List, 483

of String, 73

lastIndexOfSubList method (Collections), 524

lastKey method (SortedMap), 500

Launch4J utility, 783

Layout management, 638648

absolute positioning, 723

border, 641644

box, 700

custom, 724728

flow, 638

grid, 644648

grid bag, 700712

group, 701, 713723

sophisticated, 699730

spring, 700

LayoutManager interface

designing custom, 724728

methods of, 728

LayoutManager2 interface, 725

Leading (in typesetting), 576

Legacy code and generics, 429430

Legacy collections, 528536

bit sets, 532536

enumerations, 528530

hash tables, 528

property maps, 530531

stacks, 531

length method

of arrays, 112

of BitSet, 533

of String, 6970, 73

of StringBuilder, 78

Lightweight collection wrappers, 509510

Line2D class, 560, 565

Line2D.Double class, 569

LineBorder class, 665, 668

Linefeed, escape sequence for, 50

LineMetrics class, 577

getXxx methods, 581

Lines, 560

constructing, 565

@link comment (javadoc), 198

Linked hash maps/sets, 504506

Linked lists, 474484

concurrent modifications of, 479

doubly linked, 474

printing, 481

random access in, 479, 517

removing elements from, 475

LinkedBlockingDeque class, 903

LinkedBlockingQueue class, 899

LinkedHashMap class, 504508

access vs. insertion order, 505

as a concrete collection type, 472

removeEldestEntry method, 506, 508

LinkedHashSet class, 504507

as a concrete collection type, 472

LinkedList class, 462, 476, 479, 494

addFirst/Last, getFirst/Last methods, 484

as a concrete collection type, 472

get method, 480

listIterator method, 476

next/previousIndex methods, 480

removeAll method, 480

removeFirst/Last methods, 484

linkedList/LinkedListTest.java, 481

linkSize method (GroupLayout), 722

Linux

debugging applets in, 807

Eclipse versions for, 27

JDK versions for, 18

no thread priorities in Oracle JVM for, 859

pop-up trigger in, 685

running applets in, 3435

setting paths in, 20, 191193

setting up JDK in, 20

troubleshooting Java programs in, 26

List interface, 470, 509

add method, 470, 482

addAll method, 482

get, set methods, 470, 483

indexOf, lastIndexOf methods, 483

listIterator method, 482

remove method, 470, 483

replaceAll method, 524

sort method, 521

subList method, 510, 516

Listener interfaces, 588

Listener objects, 588

Listeners. See Action listeners, Event listeners, Window listeners

ListIterator interface, 479

add method, 470, 476478, 483

hasPrevious method, 476, 483

next/previousIndex methods, 483

previous method, 476, 483

remove method, 478

set method, 478, 483

listIterator method

of LinkedList, 476

of List, 482

Lists, 470

modifiable/resizable, 520

load method

of Properties, 531, 788, 793

of ServiceLoader, 802

Local inner classes, 339

accessing final variables from outer methods in, 339342

Local variables

annotating, 430

vs. instance fields, 151152, 173

LocalDate class, 139141

extending, 285

getXxx methods, 141, 145

minusDays method, 145

now, of methods, 140, 145

plusDays method, 141, 145

processing arrays of, 446

Locales, 393

Localization, 136, 393394, 784785

Lock interface, 878

await method, 873877

lock method, 871, 893895

lockInterruptibly method, 893895

newCondition method, 873, 877

signal method, 875877

signalAll method, 874877

tryLock method, 856, 893895

unlock method, 869, 871

vs. synchronization methods, 880

Lock objects, 868872

client-side, 883

deadlocks, 874, 889893, 896

fair, 872

hold count for, 870

inconsistent state and, 896

intrinsic, 878, 884

not with try-with-resources statement, 869

read/write, 895896

reentrant, 870

testing and timeouts, 893895

Locks

condition objects for, 872877

in synchronized blocks, 882883

log, log10 methods (Math), 58

Logarithms, 58

Logger class

add/removeHandler methods, 406

entering, exiting methods, 391, 405

get/setFilter methods, 398, 406

get/setParent methods, 406

get/setUseParentHandlers methods, 406

getGlobal method, 389, 410

getHandlers method, 406

getLevel method, 405

getLogger method, 390, 404

info method, 389

log method, 390, 392, 405

logp method, 391, 405

logrb method, 405

setLevel method, 389, 405

severe, warning, info, config, fine, finer, finest methods, 390, 404

throwing method, 392, 405

Loggers

configuring, 392393

default, 389, 391

hierarchical names of, 390

writing your own, 390392

Logging, 389408

advanced, 390392

basic, 389

file pattern variables for, 396

file rotation for, 397

filters for, 398

formatters for, 399

handlers for, 394398

configuring, 396

including class names in, 344

levels of, 390391

changing, 392393

localization of, 393394

messages for, 240

recipe for, 399408

resource bundles and, 393394

Logging proxy, 410

logging/LoggingImageViewer.java, 400

logging.properties file, 392393

Logical conditions, 52

Logical “and,” “or,” 62

LogManager class, 393

readConfiguration method, 392

LogRecord class

getLevel method, 407

getLoggerName method, 407

getMessage method, 407

getMillis method, 408

getParameters method, 407

getResourceBundle, getResourceBundleName methods, 407

getSequenceNumber method, 408

getSourceXxxName methods, 408

getThreadID method, 408

getThrown method, 408

Long class

converting from long, 252

hashCode method, 237

long type, 47

platform-independence of, 48

LongAccumulator class, methods of, 888

LongAdder class, 888, 908

add, increment, sum methods, 888

Look-and-feel, 539, 700

appearance of buttons in, 632

changing, 598603

pluggable, 756

LookAndFeelInfo class, methods of, 603

lookup method (ServiceManager), 836

Loops

break statements in, 106108

continue statements in, 108

determinate (for), 99103

“for each,” 113114

while, 9499

LotteryArray/LotteryArray.java, 126

LotteryDrawing/LotteryDrawing.java, 118

LotteryOdds/LotteryOdds.java, 102

lower method (NavigableSet), 493

Low-level events, 626

Lu, Francis, 810

M

Mac OS X

Eclipse versions for, 27

executing JARs in, 783

JDK versions for, 18

running applets in, 3435

setting paths in, 20

setting up JDK in, 20

main method, 161164

body of, 44

declared public, 43

declared static void, 4445

eliminating, for applets, 807

loading classes from, 262

not defined, 145, 179

separate for each class, 409

String[] args parameter of, 116

tagged with throws, 88

make program (UNIX), 149

MANIFEST.MF (manifest file), 781782

editing, 782

newline characters in, 782

permissions in, 823

Map interface, 469

compute, computeIfPresent/Absent methods, 501

containsKey/Value methods, 499

entrySet, keySet methods, 502503

forEach method, 499

get, put methods, 469, 497, 499

merge method, 501

putAll method, 499

remove method, 498

replaceAll method, 502

values method, 502503

map/MapTest.java, 498

Map.Entry interface, 502

getKey, get/setValue methods, 503

mappingCount method (ConcurrentHashMap), 906

Maps, 497509

adding/retrieving objects to/from, 497

concurrent, 905907

garbage collecting, 504

hash vs. tree, 497

implementations for, 497

keys for, 498

enumerating, 502

subranges of, 511

Marker interfaces, 309

Math class, 5759

E, PI static constants, 58, 159

floorMod method, 57

logarithms, 58

pow method, 57, 160

round method, 60

sqrt method, 57

trigonometric functions, 58

Matisse, 701, 713723

max method (Collections), 523

Maximum value, computing, 419

menu/MenuFrame.java, 690

MenuListener interface, 689

menuXxx methods, 689690

Menus, 678699

accelerators for, 687688

checkboxes and radio buttons in, 683684

icons in, 682683

keyboard mnemonics for, 686688

menu bar in, 679

menu items in, 679684 enabling/disabling, 689693

pop-up, 684686

submenus in, 679

merge method

of ConcurrentHashMap, 909

of Map, 501

Merge sort algorithm, 519

META-INF directory, 781

Metal look-and-feel, 541, 598

Method class, 265

getDeclaringClass method, 270

getExceptionTypes method, 270

getGenericXxx methods, 457

getModifiers method, 265, 270

getName method, 265, 270

getParameterTypes, getReturnType methods, 270

getTypeParameters method, 457

invoke method, 279283

toString method, 266

Method parameters. See Parameters

Method pointers, 279281

Method references, 319321

this, super parameters in, 320

Method tables, 216

Methods, 131

abstract, 222

in functional interfaces, 318

accessor, 141145, 153154, 444

adding, in subclasses, 207

applying to objects, 137

asynchronous, 915

body of, 4445

bridge, 428429, 440

calling by reference vs. by value, 164171

casting, 219221

concrete, 222

consistent, 231

default, 298300

deprecated, 141, 197, 412

destructor, 181182

documentation comments for, 194198

do-nothing, 604

dynamic binding for, 209, 214217

exception specification in, 362

factory, 161

final, 215, 217218, 265, 295

generic, 421422, 427429, 466469

helper, 156, 448

inlining, 7, 218

invoking, 45

arbitrary, 279283

mutator, 141145, 154, 444

names of, 201

overloading, 172

overriding, 206207, 234, 285

exceptions and, 364

return type and, 427

package scope of, 189

parameters of, 4546

passing objects to, 136

private, 156157, 215, 265

protected, 194, 228, 311

public, 194, 265, 290

reflexive, 231

resolving conflicts in, 300302

return type of, 172, 215

signature of, 172, 215

static, 160161, 185, 215, 436

adding to interfaces, 298

symmetric, 231

tracing, 351

transitive, 231

varargs, 256257

passing generic types to, 432433

visibility of, in subclasses, 217

methods/MethodTableTest.java, 282

Micro Edition (Java ME), 3, 11, 18

Microsoft

.NET platform, 6

ActiveX, 5, 15

C#, 8, 11, 218, 280

Internet Explorer, 9, 15, 803, 810

J#, J++, 8, 280

Visual Basic, 3, 136, 587, 638

Visual Studio, 23

MIME types, 825

min method (Collections), 523

Minimum value, computing, 419

minimumLayoutSize method (LayoutManager), 728

minusDays method (LocalDate), 145

mod method (BigDecimal, BigInteger), 110111

Modality, 730, 742

Model-view-controller design pattern, 632636

classes in, 632

multiple views in, 634

Modifier class

isAbstract, isInterface, isNative, isProtected, isStatic, isStrict, isSynchronized, isVolatile methods, 271

isFinal, isPrivate, isPublic, toString methods, 265, 271

Modulus, 56

Monitor concept, 884

Mosaic, 10

Mouse events, 616624

with keyboard modifiers, 616

mouse/MouseComponent.java, 620

mouse/MouseFrame.java, 619

MouseAdapter class, 619, 626

MouseEvent class, 626

getClickCount method, 616, 623, 627

getPoint method, 623, 627

getX/Y methods, 616, 623, 627

isPopupTrigger method, 686

translatePoint method, 627

MouseHandler class, 619

MouseListener interface, 617, 626

mouseClicked method, 616617, 619, 627

mouseDragged method, 619

mouseEntered/Exited methods, 619, 627

mousePressed method, 616617, 627

mouseReleased method, 616, 627

MouseMotionHandler class, 619

MouseMotionListener interface, 617, 619, 626

mouseDragged method, 628

mouseMoved method, 618619, 628

MouseWheelEvent class, 626

getScrollAmount, getWheelRotation methods, 628

MouseWheelListener interface, mouseWheelMoved method, 628

mouseXxx methods (Robot), 778

Mozilla Firefox, 34

Multidimensional arrays, 120125

printing, 240

ragged, 124127

Multiple inheritance, 297

not supported in Java, 213

Multiple selections, 103105

Multiplication operator, 56

multiply method (BigDecimal, BigInteger), 110111

Multitasking, 839

Multithreading, 7, 839952

deadlocks in, 874, 889892

deferred execution in, 325

performance and, 872, 888, 899, 920

preemptive vs. cooperative scheduling for, 855

synchronization in, 862897

using pools for, 920926

Mutator methods, 444

error checking in, 154

N

\n escape sequence, 50

NaN (not a number), 49

Napkin look-and-feel, 542

naturalOrder method (Comparator), 329

Naughton, Patrick, 1011

NavigableMap interface, 471

subMap, headMap, tailMap methods, 517

NavigableSet interface, 471, 490, 511

ceiling, floor methods, 493

descendingIterator method, 493

higher, lower methods, 493

pollFirst/Last methods, 493

subSet, headSet, tailSet methods, 511, 516

nCopies method (Collections), 510, 515

Negation operator, 62

Negative infinity, 49

.NET platform, 6

NetBeans, 20, 24, 409

Matisse, 701, 713723

specifying grid bag constraints in, 706

Netscape, 10

IFC library, 538

LiveScript/JavaScript, 15

Navigator browser, 9, 803, 810

Networking, 4

new operator, 64, 71, 136, 150

return value of, 138

with arrays, 111

with generic classes, 245

with threads, 855

new keyword, in constructor references, 321

newCachedThreadPool method (Executors), 921, 925

newCondition method (Lock), 873, 877

newFixedThreadPool method (Executors), 921, 925

newInstance method

of Array, 276, 279

of Class, 263, 265, 451

of Constructor, 265, 452

newKeySet method (ConcurrentHashMap), 912

newProxyInstance method (Proxy), 350, 355356

newScheduledThreadPool method (Executors), 921, 926

newSingleThreadExecutor method (Executors), 921, 925

newSingleThreadScheduledExecutor method (Executors), 921, 926

next method

of Iterator, 463, 465, 469

of Scanner, 81

nextDouble method (Scanner), 79, 81

nextElement method (Enumeration), 465, 528, 530

nextIndex method

of LinkedList, 480

of ListIterator, 483

nextInt method

of Random, 181

of Scanner, 79, 81

nextLine method (Scanner), 79, 81

Nimbus look-and-feel, 541

No-argument constructors, 173, 208, 801

NoClassDefFoundError, 26

node method (Preferences), 794, 799

noneOf method (EnumSet), 508

NoSuchElementException, 464, 469, 483, 494495

Notepad text editor, 26

notHelloWorld/NotHelloWorld.java, 558

notify, notifyAll methods (Objects), 878, 881882

now method (LocalDate), 140, 145

null value, 138

equality testing to, 231

nullFirst/Last methods (Comparator), 329

NullPointerException, 361, 383

Number class, 253

NumberFormat class

factory methods, 161

parse method, 256

NumberFormatException, 383

Numeric types

casting, 6061

comparing, 62, 328

converting:

to other numeric types, 5960

to strings, 254

default initialization of, 172

fixed sizes for, 6

precision of, 108

printing, 82

O

Oak programming language, 10

Object class, 132, 228244

clone method, 156, 306313, 318

equals method, 229235, 244, 302, 512

getClass method, 244

hashCode method, 235, 237, 489

no redefining for methods of, 302

notify, notifyAll methods, 878, 881882

toString method, 238244, 302, 318

wait method, 856, 878, 882

Object references

as method parameters, 165

converting, 219

default initialization of, 172

modifying, 166

Object traversal algorithms, 507

Object variables, 223

in predefined classes, 136139

initializing, 137

setting to null, 138

vs. C++ object pointers, 139

vs. objects, 137

objectAnalyzer/ObjectAnalyzer.java, 273

objectAnalyzer/ObjectAnalyzerTest.java, 273

Object-oriented programming (OOP), 4, 130135, 203

design principles of, 632

passing objects in, 302

separating time measurement from calendars in, 140

vs. procedural, 130135

Objects, 130133

analyzing at runtime, 271276

applying methods to, 137

behavior of, 132

cloning, 306313

comparing, 295

concatenating with strings, 239

constructing, 131, 171182

damaged, 896

default hash codes of, 235

destruction of, 181182

equality testing for, 229235, 262

finalize method of, 181182

identity of, 132

implementing an interface, checks of, 295

in predefined classes, 136139

initializing, 136

intrinsic locks of, 878

passing to methods, 136

references to, 138

runtime type identification of, 261

serializing, 507

sorting, 290

state of, 131132, 331334

vs. object variables, 137

Objects class

hash method, 237

hashCode method, 236237

Ocean look-and-feel, 541

Octal numbers

formatting output for, 82

prefix for, 48

of method

of EnumSet, 508

of LocalDate, 140, 145

offer method

of BlockingQueue, 898899, 904

of Queue, 494

offerFirst/Last methods

of BlockingDeque, 905

of Deque, 494

offsetByCodePoints method (String), 70, 72

Online documentation, 71, 7477, 194, 199

openFileDialog method (FileOpenService), 830, 837

openMultiFileDialog method (FileOpenService), 837

OpenType format, 575

Operators

arithmetic, 5665

bitwise, 63

boolean, 62

hierarchy of, 6465

increment/decrement, 6162

no overloading for, 109

relational, 62

Option dialogs, 731741

Optional operations, 514

optionDialog/ButtonPanel.java, 738

optionDialog/OptionDialogFrame.java, 734

or method (BitSet), 533

Oracle, 12, 18, 20

Java Plug-in, 803

JavaFX, 543

Ordered collections, 470, 476

ordinal method (Enum), 260

org.omg.CORBA package, 255

Originating host, 821

OSGi platform, 800

Output statements, 66

Output, formatting, 8287

Overloading resolution, 172, 215

@Override annotation, 234

overview.html, 198

Owner frame, 742

P

p (exponent), in hexadecimal numbers, 49

pack method (Window), 550, 557, 560

pack200 compression, 780

package statement, 183, 185

package.html, 198

package-info.java, 198

Packages, 182190

adding classes into, 185188

default, 185

documentation comments for, 194, 198

importing, 183

names of, 182, 261

online documentation for, 71

scope of, 189190

sealing, 787

PackageTest/com/horstmann/corejava/Employee.java, 188

PackageTest/PackageTest.java, 187

paintComponent method (JComponent), 554556, 560, 577, 583, 897

overriding, 624

pair1/PairTest1.java, 420

pair2/PairTest2.java, 423

pair3/PairTest3.java, 449

ParallelGroup class, 714, 723

Parallelism threshold, 910

param element (HTML), 810816

Parameterized types. See Type parameters

ParameterizedType interface, 453

getXxx methods, 458

Parameters, 4546, 164171

checking, with assertions, 386387

documentation comments for, 196

explicit, 152153

implicit, 152153, 160, 409

modifying, 165167, 169

names of, 175

string, 45

using collection interfaces in, 527

variable number of, 256257

passing generic types to, 432433

ParamTest/ParamTest.java, 170

Parent classes. See Superclasses

parse method (NumberFormat), 256

parseInt method (Integer), 254, 256, 811

Pascal, 10

architecture-neutral object file format of, 5

passing parameters in, 167

Password fields, 652653

PasswordChooser class, 746

Passwords

dialog box for, 746

reading from console, 80

PATH environment variable, 20

Path interface, 298

Paths class, 89, 298

Payne, Jonathan, 11

peek method

of BlockingQueue, 898899

of Queue, 494

of Stack, 532

peekFirst/Last methods (Deque), 495

Performance, 7

collections and, 471, 486, 906

computations and, 56, 59

JAR files and, 190

measuring with the sieve of Eratosthenes, 533536

multithreading and, 872, 888, 899, 920

of Java vs. C++, 14, 534

of tests vs. catching exceptions, 381

Permits, 935

PersistenceService class, 831

create method, 831, 837

delete method, 838

get, getNames methods, 838

Persistent storage, 272

Phaser class, 937

Physical limitations, 359

PI constant (Math), 58, 159

plaf/PlafFrame.java, 601

play method (Applet), 817

Plug-ins, 800802

plusDays method (LocalDate), 141, 145

Point class, 564

Point size (in typesetting), 574575

Point2D class, 563564

Point2D.Double class, 563, 569

Point2D.Float class, 563

poll method

of BlockingQueue, 898899, 904

of ExecutorCompletionService, 928

of Queue, 494

pollFirst/Last methods

of Deque, 495, 905

of NavigableSet, 493

Polymorphism, 209, 213214, 285

pop method (Stack), 532

Pop-up menus, 684686

triggers for, 685

Pop-up windows, 821

Positive infinity, 49

PostScript Type 1 format, 575

pow method (Math), 57, 160

Precision, of numbers, 82

Preconditions, 387

Predefined action table names, 609

Predefined classes, 135145

mutator and accessor methods in, 141145

objects and object variables in, 136139

Predicate interface, 319, 326

Preemptive scheduling, 855

Preferences, 788800

accessing, 794

enumerating keys in, 795

importing/exporting, 795

Preferences class, 794800

exportXxx methods, 795, 800

get, getDataType methods, 795, 800

importPreferences method, 795, 800

keys method, 795, 799

node method, 794, 799

platform-independency of, 794

put, putDataType methods, 795, 800

system/userNodeForPackage methods, 794, 799

system/userRoot methods, 794, 799

preferences/PreferencesTest.java, 796

preferredLayoutSize method (LayoutManager), 728

previous method (ListIterator), 476, 483

previousIndex method

of LinkedList, 480

of ListIterator, 483

Prime numbers, 533

Primitive types, 4753

as method parameters, 165

comparing, 328

converting to objects, 252

final fields of, 157

not for type parameters, 430431

transforming hash map values to, 911

values of, not object, 229

Princeton University, 5

print method (System.out), 46, 82

printf method (System.out), 8286

conversion characters for, 82

flags for, 8384

for date and time, 8485

parameters of, 256

println method (System.out), 4546, 79, 319, 389

printStackTrace method (Throwable), 264265, 377, 410

PrintStream class, 830

PrintWriter class, 87, 89

Priority queues, 495

PriorityBlockingQueue class, 899, 904

PriorityQueue class, 496

as a concrete collection type, 472

priorityQueue/PriorityQueueTest.java, 496

private access modifier, 150, 189190, 333

checking, 265

for fields, in superclasses, 206

for methods, 156157

Procedures, 130

process method (SwingWorker), 944946, 950

Processes, vs. threads, 840

Producer threads, 898

Profilers, 413

Programs. See Applications

Properties, 549, 788793

Properties class, 528531, 788793

getProperty method, 531, 789, 792

load, store methods, 531, 788, 793

setProperty method, 792

properties/PropertiesTest.java, 790

Property maps, 530531, 788793

comments in, 599

names of, 788

reading/writing, 788

PropertyChangeListener interface, 758

protected access modifier, 227228, 311

for fields, 283

Proxies, 350356

properties of, 355356

purposes of, 351

Proxy class, 355356

get/isProxyClass methods, 355356

newProxyInstance method, 350, 355356

proxy/ProxyTest.java, 353

public access modifier, 42, 56, 147150, 189190, 290

checking, 265

for fields in interfaces, 296

for main method, 43

for only one class in source file, 147

not specified for interfaces, 289

publish method

of Handler, 398, 406

of SwingWorker, 944945, 950

Pure virtual functions (C++), 224

push method (Stack), 532

put method, 908

of BlockingQueue, 898899, 904

of Map, 469, 497, 499

of Preferences, 795, 800

putAll method (Map), 499

putDataType methods (Preferences), 795, 800

putFirst/Last methods (BlockingDeque), 904

putIfAbsent method (ConcurrentHashMap), 908

putValue method (Action), 608, 615

Q

Queue interface, 460, 462, 494495

methods of, 494

Queues, 460463, 494495

blocking, 898905

concurrent, 905907

double-ended. See Deques

QuickSort algorithm, 117, 519

R

\r escape sequence, 50

Race conditions, 862868

and atomic operations, 887

Radio buttons, 660663

in menus, 683684

radioButton/RadioButtonFrame.java, 662

Ragged arrays, 124127

Random class, 181

nextInt method, 181

thread-safe, 892

Random number generation, 181, 892

RandomAccess interface, 471, 520, 522

range method (EnumSet), 508

Raw types, 425426

converting type parameters to, 441

type inquiring at runtime, 431

Read/write locks, 895896

readConfiguration method (LogManager), 392

readLine/Password methods (Console), 81

Rectangle class, 490, 564

Rectangle2D class, 560, 562565

getWidth, setRect methods, 563

Rectangle2D.Double class, 562563, 568

Rectangle2D.Float class, 562563, 569

Rectangles, 560

comparing, 490

constructing, 564

drawing, 561

filling with color, 569

RectangularShape class, 563

getHeight/Width, getCenterX/Y methods, 563, 568

getX/Y, getMinX/Y, getMaxX/Y methods, 568

Recursive computations, 929

RecursiveAction class, 929

RecursiveTask class, 929

Red-black trees, 489

reduce, reduceXxx methods (ConcurrentHashMap), 910911

Redundant keywords, 296

Reentrant locks, 870

ReentrantLock class, 868872

ReentrantReadWriteLock class, 895896

Reflection, 204, 260283

analyzing:

classes, 265271

objects, at runtime, 271276

generics and, 276279, 450458

overusing, 286

reflection/ReflectionTest.java, 267

Relational operators, 62, 64

Relative resource names, 784

remove method

of ArrayList, 249, 251

of BlockingQueue, 898899

of Collection, 467468

of Iterator, 463, 465, 469

of JMenu, 681

of List, 470, 483

of ListIterator, 478

of Map, 498

of Queue, 494

of ThreadLocal, 893

removeAll method

of Collection, 467468

of LinkedList, 480

removeEldestEntry method (LinkedHashMap), 506, 508

removeFirst/Last methods

of Deque, 495

of LinkedList, 484

removeHandler method (Logger), 406

removeIf method

of ArrayList, 319

of Collection, 468, 524

removeLayoutComponent method (LayoutManager), 728

removePropertyChangeListener method (Action), 608609

removeXxx methods (JComboBox), 669, 671

repaint method

of Component, 556

of JComponent, 559, 841, 951

replace method

of ConcurrentHashMap, 908

of String, 73

replaceAll method

of Collections, 523

of List, 524

of Map, 502

replaceRange method (JTextArea), 951

Reserved words, 43

forbidden for variable names, 53

not used, 56

resetChoosableFilters method (JFileChooser), 756, 763

resize method (Applet), 808

Resource bundles, 393394

resource/ResourceTest.java, 786

ResourceBundle class, 394

Resources, 783787

closing, 373

exhaustion of, 360

localization of, 784

names of, 784785

Restricted views, 514

resume method (Thread), 858

retain method (Collection), 467

retainAll method (Collection), 469

Retirement/Retirement.java, 97

Retirement2/Retirement2.java, 98

return statement

in finally blocks, 374

in lambda expressions, 316

Return types, 215

covariant, 429

documentation comments for, 196

for overridden methods, 427

Return values, 138

@return comment (javadoc), 196

revalidate method (JComponent), 649650, 951

reverse method (Collections), 524

reversed, reverseOrder methods (Comparator), 329, 519, 521

RoadApplet/RoadApplet.html, 36

RoadApplet/RoadApplet.java, 38

Robot class, 774778

methods of, 778

robot/RobotTest.java, 775

rotate method (Collections), 524

round method (Math), 60

Rounding mode, 111

RoundingMode class, 111

rt.jar file, 780

run method (Thread), 849, 851

runAfterXxx methods (CompletableFuture), 934

runFinalizersOnExit method (System), 182

Runnable interface, 326, 847

lambdas and, 318

run method, 325, 851

Runtime

adding shutdown hooks at, 182

analyzing objects at, 271276

creating classes at, 350

setting the size of an array at, 244

type identification at, 220, 261, 431

RuntimeException, 360, 380, 383

S

@SafeVarargs annotation, 432

Sandbox, 820822

saveAsFileDialog method (FileSaveService), 837

saveFileDialog method (FileSaveService), 830, 837

Scala programming language, default methods in, 300

Scanner class, 7981, 87, 89

next, hasNext, hasNextType methods, 81

nextXxx methods, 79, 81

Scheduled execution, 926

ScheduledExecutorService class, methods of, 926

Scroll panes, 654656

Scrollbars, 654656

Sealing, 787

search, searchXxx methods (ConcurrentHashMap), 910911

Secure certificates, 822

Security, 45, 14, 820822

@see comment (javadoc), 197198

Semantic events, 626

Semaphore class, 935

Semaphores, 935

SequentialGroup class, 714, 723

Serialization, 507

of applet objects, 809

Service loaders, 800802

ServiceLoader class, 801

iterator, load methods, 802

ServiceManager interface, 830

getServiceNames, lookup methods, 836

ServletException, 370

Servlets, 370

Set interface, methods of, 471

set method

of Array, 279

of ArrayList, 247, 251

of BitSet, 533

of Field, 276

of List, 483

of ListIterator, 478, 483

of ThreadLocal, 893

of Vector, 883

set/SetTest.java, 487

setAccelerator method (JMenuItem), 687688

setAcceptAllFileFilterUsed method (JFileChooser), 756, 763

setAccessible method (AccessibleObject), 272, 275

setAccessory method (JFileChooser), 763

setAction method (AbstractButton), 681

setActionCommand method (AbstractButton), 663

setAutoCreateXxx methods (GroupLayout), 722

setBackground method (Component), 570, 573

setBoolean, setByte, setChar methods (Array), 279

setBorder method (JComponent), 664, 668

setBounds method (Component), 546, 552, 724

coordinates in, 548

setCharAt method (StringBuilder), 78

setClassAssertionStatus method (ClassLoader), 388

setColor method

of Graphics, 570, 572

of JColorChooser, 770

setColumns method

of JTextArea, 654, 656

of JTextField, 649650

setComponentPopupMenu method (JComponent), 685686

setCurrentDirectory method (JFileChooser), 754, 762

setCursor method (Component), 624

setDaemon method (Thread), 859860

setDebugGraphicsOptions method (JComponent), 771

setDefaultAssertionStatus method (ClassLoader), 388

setDefaultButton method (JRootPane), 748, 752

setDefaultCloseOperation method (JDialog), 743, 807

setDefaultUncaughtExceptionHandler method (Thread), 411, 860861

setDisplayedMnemonicIndex method (AbstractButton), 686, 688

setDouble method (Array), 279

setEchoChar method (JPasswordField), 653

setEditable method

of JComboBox, 669, 671

of JTextComponent, 648

setEnabled method

of Action, 608, 615

of JMenuItem, 689690

setExtendedState method (Frame), 553

setFileFilter method (JFileChooser), 755, 763

setFileSelectionMode method (JFileChooser), 754, 763

setFileView method (JFileChooser), 756757, 763

setFilter method

of Handler, 406

of Logger, 398, 406

setFloat method (Array), 279

setFont method

of Graphics, 581

of JComponent, 650

setForeground method (Component), 570, 573

setFormatter method (Handler), 399, 406

setFrameFromCenter method (Ellipse2D), 565

setFrameFromDiagonal method (Ellipse2D), 564

setHonorsVisibility, setHorizontalGroup methods (GroupLayout), 722

setHorizontalTextPosition method (AbstractButton), 682683

setIcon method

of JLabel, 651652

of JMenuItem, 682

setIconImage method (Frame), 546, 553

setInheritsPopupMenu method (JComponent), 685686

setInt method (Array), 279

setInverted method (JSlider), 674, 678

setJMenuBar method (JFrame), 679, 682

setLabelTable method (JSlider), 429, 673, 678

setLayout method (Container), 641

setLevel method

of Handler, 406

of Logger, 389, 405

setLineWrap method (JTextArea), 654, 656

setLocation method (Component), 546, 552

coordinates in, 548

setLocationByPlatform method (Window), 552

setLong method (Array), 279

setLookAndFeel method (UIManager), 599, 602

setMnemonic method (AbstractButton), 687688

setModel method (JComboBox), 669

setMultiSelectionEnabled method (JFileChooser), 754, 763

setOut method (System), 159

setPackageAssertionStatus method (ClassLoader), 388

setPaint method (Graphics2D), 569, 573

setPaintLabels method (JSlider), 673, 678

setPaintTicks method (JSlider), 673674, 678

setPaintTrack method (JSlider), 678

setParent method (Logger), 406

setPriority method (Thread), 859

setProperty method

of Properties, 792

of System, 392

setRect method (Rectangle2D), 563

setResizable method (Frame), 546, 553

setRows method (JTextArea), 654, 656

Sets, 487

concurrent, 905907

intersecting, 525

mutating elements of, 487

subranges of, 511

thread-safe, 912

setSelected method

of AbstractButton, 684

of JCheckBox, 657, 659

setSelectedFile/Files methods (JFileChooser), 754, 763

setSelectionStart/End methods (JComponent), 952

setShort method (Array), 279

setSize method (Component), 552

setSnapToTicks method (JSlider), 673, 678

setTabSize method (JTextArea), 656

setText method

of JLabel, 651652

of JTextComponent, 648, 650, 951

setTime method (Calendar), 218

setTitle method (JFrame), 546, 553

setToolTipText method (JComponent), 699

setUncaughtExceptionHandler method (Thread), 861

setUndecorated method (Frame), 546, 553

setUseParentHandlers method (Logger), 406

setValue method (Map.Entry), 503

setVerticalGroup method (GroupLayout), 722

setVisible method

of Component, 546, 552, 951

of JDialog, 743, 746, 807

setWrapStyleWord method (JTextArea), 656

setXxxTickSpacing methods (JSlider), 678

severe method (Logger), 390, 404

Shallow copies, 308310

Shape interface, 560561

Shell

redirection syntax of, 88

scripts in, 193

Shift operators, 63

short type, 47

Short class

converting from short, 252

hashCode method, 237

show method (JPopupMenu), 685

showConfirmDialog method (JOptionPane), 731732, 739

showDialog method

of JColorChooser, 770

of JFileChooser, 747, 752, 754, 763

showDocument method

of AppletContext, 819820

of BasicService, 836

showInputDialog method (JOptionPane), 731732, 740

showInternalConfirmDialog, showInternalMessageDialog methods (JOptionPane), 739

showInternalInputDialog method (JOptionPane), 741

showInternalOptionDialog method (JOptionPane), 740

showMessageDialog method (JOptionPane), 304, 731732, 739

showOptionDialog method (JOptionPane), 731732, 739740

showStatus method (Applet), 819820

showXxxDialog methods (JFileChooser), 747, 752, 754, 763

shuffle method (Collections), 520521

shuffle/ShuffleTest.java, 520

Shuffling, 520

Shutdown hooks, 182

shutdown method (ExecutorService), 922, 925

shutdownNow method (ExecutorService), 922, 927

Sieve of Eratosthenes benchmark, 533536

sieve/sieve.cpp, 535

sieve/Sieve.java, 534

signal method (Condition), 875877, 890

signalAll method (Condition), 874877, 890

Signatures (of methods), 172, 215

simpleframe/SimpleFrameTest.java, 544

sin method (Math), 58

Single-thread rule (Swing), 939, 951952

singleton, singletonCollection methods

(Collections), 510, 515

size method

of ArrayList, 246247

of Collection, 467468

of concurrent collections, 905

sizedFrame/SizedFrameTest.java, 551

sleep method (Thread), 841, 846847, 852

slider/SliderFrame.java, 674

Sliders, 672678

ticks on, 673674

vertical, 672

SoftBevelBorder class, 665, 667

Software Development Kit (SDK), 18

Solaris

Eclipse versions for, 27

executing JARs in, 783

JDK versions for, 18

sort method

of Arrays, 117119, 290, 292, 294, 314, 318

of Collections, 518521

of List, 521

SortedMap interface, 471

comparator, first/lastKey methods, 500

subMap, headMap, tailMap methods, 511, 516

SortedSet interface, 471, 511

comparator, first, last methods, 493

subSet, headSet, tailSet methods, 511, 516

Sorting

algorithms for, 117, 518521

arrays, 117120, 292

assertions for, 387

in reverse order, 519

people, by name, 328329

strings by length, 305306, 314, 316

Source files, 192

editing in Eclipse, 29

installing, 2223

Special characters, 50

Splash screen, 262

Spring layout, 700

sqrt method (Math), 57

src.zip file, 22

Stack interface, 460, 528, 531

peek, pop, push methods, 532

Stack trace, 377381, 889

Stacks, 531

stackTrace/StackTraceTest.java, 378

StackTraceElement class

getLineNumber method, 380

getXxxName methods, 380

isNativeMethod method, 381

toString method, 378, 381

Standard Edition (Java SE), 11, 18

Standard Java library

companion classes in, 298

online API documentation for, 71, 7477, 194, 199

packages in, 182

Standard Template Library (STL), 460, 465

start method

of Applet, 808

of Thread, 849, 851, 855

of Timer, 305

startsWith method (String), 72

stateChanged method (ChangeListener), 672673

Statements, 45

compound. See Blocks

static access modifier, 158164

for fields in interfaces, 296

for main method, 4445

Static binding, 215

Static constants, 159

documentation comments for, 196

Static fields, 158159

accessing, in static methods, 160

importing, 185

initializing, 178

no type variables in, 436

static final access modifier, 55

Static imports, 185

Static inner classes, 331, 346349

Static methods, 160161

accessing static fields in, 160

adding to interfaces, 298

importing, 185

no type variables in, 436

Static variables, 159

staticInnerClass/StaticInnerClassTest.java, 348

StaticTest/StaticTest.java, 163

stop method

of Applet, 808

of Thread (deprecated), 851, 858, 896897

of Timer, 305

store method (Properties), 531, 788, 793

Strategy design pattern, 631

Stream interface, toArray method, 321

StreamHandler class, 397

strictfp keyword, 57

StrictMath class, 57, 59

String class, 6578

charAt method, 70, 72

codePointAt, codePoints methods, 72

codePointCount method, 70, 73

compareTo method, 72

endsWith method, 72

equals, equalsIgnoreCase methods, 68, 72

format, formatTo methods, 83

hashCode method, 235, 485

immutability of, 67, 157, 218

indexOf method, 73, 172

join method, 73

lastIndexOf method, 73

length method, 6970, 73

offsetByCodePoints method, 70, 72

replace method, 73

startsWith method, 72

substring method, 66, 73, 510

toLowerCase, toUpperCase methods, 73

trim method, 73, 650

StringBuilder class, 7778

append method, 7778

appendCodePoint method, 78

delete method, 78

insert method, 78

length method, 78

setCharAt method, 78

toString method, 7778

Strings, 6578

building, 7778

code points/code units of, 70

comparing, 305306

concatenating, 6667

with objects, 239

converting to numbers, 254

empty, 69

equality of, 68

formatting output for, 8287

immutability of, 67

length of, 66, 69

null, 69

shared, in compiler, 67, 69

sorting by length, 305306, 314, 316

substrings of, 66

using ". . ." for, 45

Strongly typed languages, 47, 291

Subclasses, 204228

adding fields/methods to, 207

anonymous, 344

cloning, 311

comparing objects from, 295

constructors for, 207

defining, 204

method visibility in, 217

no access to private fields of superclass, 227

overriding superclass methods in, 207

subList method (List), 510, 516

subMap method

of NavigableMap, 517

of SortedMap, 511, 516

Submenus, 679

submit method

of ExecutorCompletionService, 925, 928

of ExecutorService, 921

Subranges, 510511

subSet method (NavigableSet, SortedSet), 511, 516

Substitution principle, 213

substring method (String), 66, 73, 510

subtract method (BigDecimal, BigInteger), 110111

Subtraction operator, 56

sum method (LongAdder), 888

Sun Microsystems, 2, 512, 14, 539

HotJava browser, 11, 802

Java Plug-in, 803

super keyword, 207, 444

capturing in method references, 320

vs. this, 207208

Superclass wins rule, 300

Superclasses, 204228

accessing private fields of, 206

common fields and methods in, 223, 283

overriding methods of, 234

throws specifiers in, 364, 369

Supertype bounds, 444447

Supplementary characters, 52

Supplier interface, 326

@SuppressWarnings annotation, 105, 252, 430, 432, 437439

Surrogates area (Unicode), 52

suspend method (Thread, deprecated), 858, 896897

swap method (Collections), 524

Swing, 537586, 629778

advantages of, 539

debugging, 770778

double buffering in, 771

implementing applets with, 803808

in full-screen, 550

model-view-controller analysis of, 636638

starting, 545

threads and, 937943

single-thread rule, 939, 951952

Swing graphics debugger, 771

swing/SwingThreadTest.java, 940

swing.properties file, 598

SwingConstants interface, 296, 651

SwingUtilities class

getAncestorOfClass method, 747, 752

updateComponentTreeUI method, 599

SwingWorker class, 943950

doInBackground method, 944945, 950

execute method, 945, 950

getState method, 950

process method, 944946, 950

publish method, 944945, 950

swingWorker/SwingWorkerTest.java, 947

switch statement, 103105

enumerated constants in, 105

missing break statements in, 412

SWT toolkit, 543

synch/Bank.java, 875

synch2/Bank.java, 880

Synchronization, 862897

condition objects, 872877

final variables, 886

in Vector, 484

lock objects, 868872

lock testing and timeouts, 893895

monitor concept, 884

race conditions, 862868, 887

read/write locks, 895

volatile fields, 885886

Synchronization primitives, 935

Synchronization wrappers, 914915

Synchronized blocks, 882883

synchronized keyword, 868, 878882, 884

Synchronized views, 512513

synchronizedCollection methods (Collections), 512513, 515, 915

Synchronizers, 934937

barriers, 936937

countdown latches, 936

exchangers, 937

semaphores, 935

synchronous queues, 937

SynchronousQueue class, 935937

Synth look-and-feel, 542

System class

console method, 81

exit method, 45

getProperties method, 789, 793

getProperty method, 793

identityHashCode method, 507, 509

runFinalizersOnExit method, 182

setOut method, 159

setProperty method, 392

System of Patterns, A (Buschmann et al.), 632

System.err class, 411

System.in class, 79

System.out class, 4546, 159, 411

print method, 82

printf method, 8286, 256

println method, 79, 389

SystemColor class, 571572

systemNodeForPackage method (Preferences), 794, 799

systemRoot method (Preferences), 794, 799

T

T type variable, 419

\t escape sequence, 50

Tab key

escape sequence for, 50

navigating GUI controls with, 729

Tagging interfaces, 309, 426, 471

tailMap method

of NavigableMap, 517

of SortedMap, 511, 516

tailSet method (NavigableSet, SortedSet), 511, 516

take method

of BlockingQueue, 898899, 904

of ExecutorCompletionService, 928

takeFirst/Last methods (BlockingDeque), 904

tan method (Math), 58

tar command, 780

target attribute (HTML), 820

Tasks

controlling groups of, 927928

decoupling from mechanism of running, 848

interrupting, 842

multiple, 839

running asynchronously, 915

scheduled, 926

time-consuming, 939943

work stealing for, 930

Template code bloat, 426

Terminal window, 25

Text

centering, 576

displaying, 557

fonts for, 573582

typesetting properties of, 576

Text areas, 653654

formatted text in, 654

preferred size of, 654

scrollbars in, 654656

Text fields, 649651

columns in, 649

creating blank, 650

preferred size of, 649

Text input, 648656

labels for, 651652

password fields, 652653

scroll panes, 654

text/TextComponentFrame.java, 655

thenAccept, thenApply, thenApplyAsync, thenRun methods (CompletableFuture), 933

thenAcceptBoth, thenCombine methods (CompletableFuture), 934

thenComparing method (Comparator), 328329

thenCompose method (CompletableFuture), 932933

this keyword, 152, 176

capturing in method references, 320

in first statement of constructor, 176

in inner classes, 335

in lambda expressions, 324

vs. super, 207208

Thread class

currentThread method, 851854

extending, 848

get/setUncaughtExceptionHandler methods, 861

getDefaultUncaughtExceptionHandler method, 861

getState method, 858

interrupt, isInterrupted methods, 851854

interrupted method, 853854

join method, 856858

methods with timeout, 856

resumes method, 858

run method, 849, 851

setDaemon method, 859860

setDefaultUncaughtExceptionHandler method, 411, 860861

setPriority method, 859

sleep method, 841, 846847, 852

start method, 849, 851, 855

stop method (deprecated), 851, 858, 896897

suspend method (deprecated), 858, 896897

yield method, 859

Thread dump, 889

Thread groups, 860

Thread pools, 920926

of fixed size, 921

Thread.UncaughtExceptionHandler interface, 860862

ThreadDeath error, 857, 862, 896

ThreadGroup class, 861

uncaughtException method, 861862

ThreadLocal class, methods of, 893

ThreadLocalRandom class, current method, 893

threadPool/ThreadPoolTest.java, 922

ThreadPoolExecutor class, 921922

getLargestPoolSize method, 926

Threads

accessing collections from, 512513, 905915

blocked, 852, 856857

condition objects for, 872877

daemon, 859

defined, 840851

executing code in, 325

handlers for uncaught exceptions in, 860862

idle, 928

interrupting, 851854

listing all, 889

locking, 882883

new, 855

preemptive vs. cooperative scheduling for, 855

priorities of, 858

producer/customer, 898

purposes of, 846851

runnable, 855856

simple procedure for, 846851

states of, 855858

Swing and, 937943, 951952

synchronizing, 862897, 934937

terminated, 847, 851, 857

thread-local variables in, 892893

timed waiting, 856857

unblocking, 875

vs. processes, 840

waiting, 856857, 873

work stealing for, 930

Thread-safe collections, 905915

callables and futures, 915920

concurrent, 905907

copy on write arrays, 912

synchronization wrappers, 914915

throw keyword, 364365

Throwable class, 360, 383

add/getSuppressed methods, 377, 380

get/initCause methods, 379

getMessage method, 366

getStackTrace method, 377, 379

printStackTrace method, 264265, 377, 410

toString method, 366

throwing method (Logger), 392, 405

throws keyword, 361364

for main method, 88

@throws comment (javadoc), 196

Ticks, 673

icons for, 674

labeling, 673

snapping to, 673

Time measurement vs. calendars, 140

Timed waiting threads, 856857

Timeless Way of Building, The (Alexander), 630

TimeoutException, 915

Timer class, 302, 314, 627

start, stop methods, 305

timer/TimerTest.java, 304

title element (HTML), 807

toArray method

of ArrayList, 435

of Collection, 249, 467, 469

of Stream, 321

toBack/Front methods (Window), 552

toLowerCase method (String), 73

Tomcat, 824838

toolBar/ToolBarFrame.java, 697

Toolbars, 694696

detaching, 695

dragging, 694

title of, 696

vertical, 696

Toolkit class

beep method, 305

createCustomCursor method, 618, 623

getDefaultToolkit method, 305, 549, 553

getScreenSize method, 549, 553

Toolkit-modal dialogs, 742

Tooltips, 696699

toString method

adding to all classes, 240

Formattable and, 83

of Arrays, 114, 119

of Date, 137

of Enum, 258, 260

of Integer, 256

of Modifier, 266, 271

of Object, 238244, 302

of proxy classes, 355

of StackTraceElement, 378, 381

of StringBuilder, 7778

of Throwable, 366

redeclaring, 318

working with any class, 272

Total ordering, 490

toUpperCase method (String), 73

TraceHandler class, 351

Tracing execution flow, 391

TransferQueue interface, 900

transfer, tryTransfer methods, 905

translatePoint method (MouseEvent), 627

Traversal order, 729730

Tree maps, 497

Tree sets, 489493

adding elements to, 490

red-black, 489

total ordering of, 490

vs. priority queues, 495

TreeMap class, 471, 497, 500

as a concrete collection type, 472

vs. HashMap, 497

TreeSet class, 471, 489493

as a concrete collection type, 472

treeSet/Item.java, 491

treeSet/TreeSetTest.java, 490

Trigonometric functions, 58

trim method (String), 73, 650

trimToSize method (ArrayList), 246247

Troubleshooting. See Debugging

TrueType format, 575

Truncated computations, 56

try/catch statement, 264, 367372

decoupling, 374

generics and, 436437

wrapping entire task in try block, 382

try/finally statement, 372376

decoupling, 374

tryLock method (Lock), 856, 893895

Try-with-resources statement, 376377

no locks with, 869

Two-dimensional arrays, 120125

Type interface, 453

Type erasure, 425430

clashes after, 439440

Type parameters, 245

converting to raw types, 441

not for arrays, 431432, 441

not instantiated with primitive types, 430431

vs. inheritance, 416

Type variables

bounds for, 422424

in exceptions, 437

in static fields or methods, 436

matching in generic methods, 452

names of, 419

no instantiating for, 433434

replacing with bound types, 425426

Typesetting terms, 576

TypeVariable interface, 453

getBounds, getName methods, 457

U

UCSD Pascal system, 5

UIManager class

getInstalledLookAndFeels, setLookAndFeel methods, 602

setLookAndFeel method, 599

UML (Unified Modeling Language) notation, 134135

UnaryOperator interface, 326

UnavailableServiceException, 830

uncaughtException method (ThreadGroup), 861862

UncaughtExceptionHandler interface, 860862

uncaughtException method, 861

Unchecked exceptions, 264, 361363

applicability of, 383

Unequality operator, 62

Unicode standard, 6, 5152, 65

in char type, 50

Unit testing, 162

University of Illinois, 10

UNIX

Eclipse versions for, 27

JNLP configuration in, 828

running applets in, 34

setting paths in, 20, 191193

setting up JDK in, 20

system directories, 788

troubleshooting Java programs in, 26

unlock method (Lock), 869, 871

Unmodifiable views, 511512

unmodifiableCollection methods (Collections), 511512, 514

UnsupportedOperationException, 503, 510, 512, 514

unsynch/Bank.java, 865

unsynch/UnsynchBankTest.java, 864

updateAndGet method (AtomicType), 887

updateComponentTreeUI method (SwingUtilities), 599

User input, 650

errors of, 359

User Interface. See Graphical User Interface

userNodeForPackage method (Preferences), 794, 799

userRoot method (Preferences), 794, 799

“Uses–a” relationship, 133135

UTC (Coordinated Universal Time), 139

UTF-8 standard, 87

Utility classes, 298299

V

V type variable, 419

validate method (Component), 651, 951

valueOf method

of BigDecimal, BigInteger, 108, 110111

of Enum, 258, 260

of Integer, 256

values method (Map), 502503

Values, captured by lambda expressions, 323

Varargs, 256257

passing generic types to, 432433

Variables, 5356

accessing in lambdas, 322324

copying, 306

declarations of, 53

deprecated, 197

effectively final, 324

final, accessing from outer methods, 339342

initializing, 54, 200

local, 138, 430

annotating, 430

mutating in lambda expressions, 323

names of, 5356

package scope of, 189

printing/logging values of, 409

static, 159

thread-local, 892893

Vector class, 460, 528, 883, 914915

elements method, 530

for dynamic arrays, 245

get, set methods, 883

synchronization in, 484

@version comment (javadoc), 197, 199

Views, 509, 633

bulk operations for, 525

checked, 513

restricted, 514

subranges of, 510511

synchronized, 512513

unmodifiable, 511512

Visual Basic programming language

built-in date type in, 136

event handling in, 587

forms in, 638

syntax of, 3

Visual Studio, 23

void keyword, 4445

Volatile fields, 885886

volatile keyword, 885886

von der Ahé, Peter, 422

W

wait method (Object), 856, 878, 882

Wait sets, 873

warning method (Logger), 390, 404

Warnings

fallthrough behavior, 105

generic types, 252, 430, 432, 437439

suppressing, 432, 437439

Weak hash maps, 504

Weak references, 504

WeakHashMap class, 504, 507

as a concrete collection type, 472

Weakly consistent iterators, 906

WeakReference object, 504

Web pages

dynamic, 9

reading from URL, 932

showing applets on, 802824

title of, 807

webstart/CalculatorFrame.java, 832

Welcome/Welcome.java, 25

whenComplete method (CompletableFuture), 933

while loop, 9499

Whitespace, irrelevant to Java compiler, 44

Wildcard types, 417, 442450

arrays of, 432

capturing, 448450

supertype bounds for, 444447

unbounded, 447

WildcardType interface, 453

getLowerBounds, getUpperBounds methods, 458

Window class, 628

is/setLocationByPlatform methods, 552

pack method, 550, 557, 560

toBack/Front methods, 552

Window listeners, 603607

Window place, 630631

WindowAdapter class, 626

WindowClosing event, 688

WindowEvent class, 588, 603, 626

getNewState, getOldState methods, 607, 628

getWindow, getOppositeWindow, getScrollAmount methods, 628

WindowFocusListener interface, 626

windowGainedFocus, windowLostFocus methods, 628

WindowListener interface, 626

windowActivated/Deactivated methods, 603, 607, 628

windowClosing/Closed methods, 603607, 628

windowIconified/Deiconified methods, 603, 607, 628

windowOpened method, 603, 606, 628

Windows. See Dialogs

Windows look-and-feel, 539540

Windows operating system

Alt+F4 in, 688

debugging applets in, 807

default location in, 395

device context in, 556

Eclipse versions for, 27

executing JARs in, 783

file separators in, 785

fonts shipped with, 574

JDK versions for, 18

pop-up trigger in, 685

registry in, 794795

resources in, 783

running applets in, 3435

setting paths in, 20, 191, 193

setting up JDK in, 20

thread priority levels in, 859

WindowStateListener interface, 603, 626

windowStateChanged method, 607, 628

Wirth, Niklaus, 5, 10, 130

withInitial method (ThreadLocal), 893

Work stealing, 930

Wrappers, 252256

equality testing for, 254

immutability of, 253

lightweight collection, 509510

X

X11 programming, 556

XML (Extensible Markup Language), 1213

xor method (BitSet), 533

Y

yield method (Thread), 859

Z

ZIP format, 191, 780