Java: The Complete Reference 12th Edition Herbert Schildt - eBook PDF instant download
Java: The Complete Reference 12th Edition Herbert Schildt - eBook PDF instant download
https://ebookluna.com/download/java-the-complete-reference-ebook-
pdf/
https://ebookluna.com/download/java-a-beginners-guide-ebook-pdf/
ebookluna.com
https://ebookluna.com/download/java-a-beginners-guide-eighth-edition-
ebook-pdf/
ebookluna.com
https://ebookluna.com/download/java-a-beginners-guide-create-compile-
and-run-java-programs-today-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/tableau-10-complete-reference-ebook-pdf/
ebookluna.com
Mosby’s dental drug reference 12th Edition - eBook PDF
https://ebookluna.com/download/mosbys-dental-drug-reference-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-kelly-l-murdocks-autodesk-3ds-
max-2018-complete-reference-guide/
ebookluna.com
https://ebookluna.com/product/original-pdf-mosbys-dental-drug-
reference-e-book-12th-edition/
ebookluna.com
https://ebookluna.com/download/gomella-and-haists-clinicians-pocket-
reference-12th-edition-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-technology-in-action-
complete-12th-edition-by-alan-evans/
ebookluna.com
CompRef_2010 / Java: The Complete Reference, Twelfth Edition / Schildt / 126046-341-9 / blind folio: i
The
Complete Java™
Reference Twelfth Edition
The
Complete Java™
Reference Twelfth Edition
Herbert Schildt
ISBN: 978-1-26-046342-2
MHID: 1-26-046342-7
The material in this eBook also appears in the print version of this title: ISBN: 978-1-26-046341-5,
MHID: 1-26-046341-9.
All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a
trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of
infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.
McGraw-Hill Education eBooks are available at special quantity discounts to use as premiums and sales promotions or for
use in corporate training programs. To contact a representative, please visit the Contact Us page at www.mhprofessional.com.
Information has been obtained by McGraw Hill from sources believed to be reliable. However, because of the possibility of
human or mechanical error by our sources, McGraw Hill, or others, McGraw Hill does not guarantee the accuracy, adequacy,
or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of
such information.
Oracle Corporation does not make any representations or warranties as to the accuracy, adequacy, or completeness of any in-
formation contained in this Work, and is not responsible for any errors or omissions.
TERMS OF USE
This is a copyrighted work and McGraw-Hill Education and its licensors reserve all rights in and to the work. Use of this work
is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the
work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit,
distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill Education’s prior consent.
You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right
to use the work may be terminated if you fail to comply with these terms.
THE WORK IS PROVIDED “AS IS.” McGRAW-HILL EDUCATION AND ITS LICENSORS MAKE NO GUARANTEES
OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED
FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK
VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, IN-
CLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICU-
LAR PURPOSE. McGraw-Hill Education and its licensors do not warrant or guarantee that the functions contained in the work
will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill Education nor its
licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any
damages resulting therefrom. McGraw-Hill Education has no responsibility for the content of any information accessed through
the work. Under no circumstances shall McGraw-Hill Education and/or its licensors be liable for any indirect, incidental,
special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them
has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever
whether such claim or cause arises in contract, tort or otherwise.
CompRef_2010 / Java: The Complete Reference, Twelfth Edition / Schildt / 126046-341-9
Contents at a Glance
PART I The Java Language
1 The History and Evolution of Java 3
2 An Overview of Java 21
3 Data Types, Variables, and Arrays 39
4 Operators 67
5 Control Statements 87
6 Introducing Classes 117
7 A Closer Look at Methods and Classes 137
8 Inheritance 171
9 Packages and Interfaces 199
10 Exception Handling 227
11 Multithreaded Programming 247
12 Enumerations, Autoboxing, and Annotations 277
13 I/O, Try-with-Resources, and Other Topics 315
14 Generics 347
15 Lambda Expressions 391
16 Modules 421
17 Switch Expressions, Records,
and Other Recently Added Features 449
PART II The Java Library
18 String Handling 483
19 Exploring java.lang 511
20 java.util Part 1: The Collections Framework 571
21 java.util Part 2: More Utility Classes 653
22 Input/Output: Exploring java.io 713
23 Exploring NIO 763
24 Networking 795
25 Event Handling 819
26 Introducing the AWT: Working with
Windows, Graphics, and Text 851
27 Using AWT Controls, Layout Managers, and Menus 879
28 Images 929
29 The Concurrency Utilities 955
30 The Stream API 1005
31 Regular Expressions and Other Packages 1031
Index
1203
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi
vii
Contents ix
Contents xi
finally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Java’s Built-in Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Creating Your Own Exception Subclasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Chained Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Three Additional Exception Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Using Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Chapter 11 Multithreaded Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
The Java Thread Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Thread Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
The Thread Class and the Runnable Interface . . . . . . . . . . . . . . . . . . . . 250
The Main Thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Creating a Thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Implementing Runnable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Extending Thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Choosing an Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Creating Multiple Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Using isAlive( ) and join( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Thread Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Using Synchronized Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
The synchronized Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Interthread Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Deadlock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Suspending, Resuming, and Stopping Threads . . . . . . . . . . . . . . . . . . . . . . . . 272
Obtaining a Thread’s State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Using a Factory Method to Create and Start a Thread . . . . . . . . . . . . . . . . . 275
Using Multithreading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Chapter 12 Enumerations, Autoboxing, and Annotations . . . . . . . . . . . . . . . . . . . . . 277
Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Enumeration Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
The values( ) and valueOf( ) Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Java Enumerations Are Class Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Enumerations Inherit Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Another Enumeration Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Type Wrappers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
The Numeric Type Wrappers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Autoboxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Autoboxing and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Autoboxing/Unboxing Occurs in Expressions . . . . . . . . . . . . . . . . . . . 291
Autoboxing/Unboxing Boolean and Character Values . . . . . . . . . . . . 292
Contents xiii
Contents xv
Contents xvii
ClassValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
The CharSequence Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
The Comparable Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
The Appendable Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
The Iterable Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
The Readable Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
The AutoCloseable Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
The Thread.UncaughtExceptionHandler Interface . . . . . . . . . . . . . . . . . . . . 567
The java.lang Subpackages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
java.lang.annotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
java.lang.constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
java.lang.instrument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
java.lang.invoke . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
java.lang.management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
java.lang.module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
java.lang.ref . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
java.lang.reflect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
Chapter 20 java.util Part 1: The Collections Framework . . . . . . . . . . . . . . . . . . . . . . . 571
Collections Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572
The Collection Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
The Collection Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
The List Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
The Set Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
The SortedSet Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
The NavigableSet Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
The Queue Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582
The Deque Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
The Collection Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
The ArrayList Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
The LinkedList Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
The HashSet Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590
The LinkedHashSet Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
The TreeSet Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
The PriorityQueue Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
The ArrayDeque Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594
The EnumSet Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
Accessing a Collection via an Iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
Using an Iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
The For-Each Alternative to Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
Spliterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
Storing User-Defined Classes in Collections . . . . . . . . . . . . . . . . . . . . . . . . . . 602
The RandomAccess Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
Working with Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
The Map Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
The Map Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
Contents xix
Comparators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616
Using a Comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
The Collection Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
The Legacy Classes and Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
The Enumeration Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
Hashtable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Using store( ) and load( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
Parting Thoughts on Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652
Chapter 21 java.util Part 2: More Utility Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
StringTokenizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
BitSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655
Optional, OptionalDouble, OptionalInt, and OptionalLong . . . . . . . . . . . . 658
Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 660
Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662
GregorianCalendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
TimeZone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667
SimpleTimeZone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
Locale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
Random . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
Timer and TimerTask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672
Currency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675
Formatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676
The Formatter Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676
The Formatter Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
Formatting Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
Formatting Strings and Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
Formatting Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
Formatting Time and Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
The %n and %% Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683
Specifying a Minimum Field Width . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683
Specifying Precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685
Using the Format Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
Justifying Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
The Space, +, 0, and ( Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
The Comma Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
The # Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
The Uppercase Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
Using an Argument Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
Closing a Formatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
The Java printf( ) Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
The Scanner Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Scanning Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Some Scanner Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
Setting Delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
Other Scanner Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700
The ResourceBundle, ListResourceBundle,
and PropertyResourceBundle Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
Miscellaneous Utility Classes and Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . 706
The java.util Subpackages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
java.util.concurrent, java.util.concurrent.atomic,
and java.util.concurrent.locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
java.util.function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
java.util.jar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
java.util.logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
java.util.prefs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
java.util.random . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
java.util.regex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
java.util.spi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
java.util.stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
java.util.zip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
Chapter 22 Input/Output: Exploring java.io . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713
The I/O Classes and Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717
Using FilenameFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
The listFiles( ) Alternative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
Creating Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720
The AutoCloseable, Closeable, and Flushable Interfaces . . . . . . . . . . . . . . . 720
I/O Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721
Two Ways to Close a Stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721
The Stream Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
The Byte Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
InputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
OutputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
FileInputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
FileOutputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727
ByteArrayInputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
ByteArrayOutputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
Filtered Byte Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
Buffered Byte Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
SequenceInputStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736
PrintStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737
DataOutputStream and DataInputStream . . . . . . . . . . . . . . . . . . . . . . . 740
RandomAccessFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742
Contents xxi
URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
URLConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804
HttpURLConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806
The URI Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808
Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808
TCP/IP Server Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
Datagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
DatagramSocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
DatagramPacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
A Datagram Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
Introducing java.net.http . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813
Three Key Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813
A Simple HTTP Client Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816
Things to Explore in java.net.http . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818
Chapter 25 Event Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819
Two Event Handling Mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819
The Delegation Event Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
Event Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
Event Listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821
Event Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821
The ActionEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822
The AdjustmentEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824
The ComponentEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824
The ContainerEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825
The FocusEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825
The InputEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826
The ItemEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 827
The KeyEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828
The MouseEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829
The MouseWheelEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 830
The TextEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831
The WindowEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831
Sources of Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 832
Event Listener Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833
The ActionListener Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833
The AdjustmentListener Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
The ComponentListener Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
The ContainerListener Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
The FocusListener Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
The ItemListener Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
The KeyListener Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
The MouseListener Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835
Contents xxiii
"What business?"
"The insurance business. I don't care for you, and you show very plainly
that you don't care for me. It is useless for us to struggle together like a
couple of ill-matched dogs in leash. Give me fifteen thousand of this
money, and then you can marry your Lola woman."
Jim turned white again. "You seem jolly anxious to get rid of me."
"Can you wonder if I do? How many women would take this scandalous
matter as quietly as I do?"
His wife shrugged her shoulders. It was rather late in the day for Jim to talk
sentiment, besides being a waste of time. "Well?" she asked, facing him
squarely.
Jim read her purpose in a very flinty face. "I'll do what you want," he said
weakly.
"I have meant it from the first moment you put the idea into my head," she
said in a harsh voice. "This underhand love-making of yours only makes me
the more determined."
"Then I choose the fifteen thousand pounds," she said, and vanished into the
bedroom. Jim took an impulsive step towards the door, but the sharp click
of a turning key showed him that he was locked out for ever.
That evening Leah talked so gaily, and looked so beautiful, that her father-
in-law was absolutely fascinated. "Is it all right between you and James?"
he asked graciously.
CHAPTER XII
Leah welcomed the New Year at Firmingham, with the fervent hope that its
bounty would bestow the insurance money, and rid her of an official
husband. It really seemed as though Providence, or the fetish, was in a
benign mood, for Jim caught the worst of colds while skating. Being
confined to an undesired bed, and fed with food tasteless to a cultivated
palate, he lost both flesh and temper. Demetrius talked gravely of weak
lungs, and hinted at inherited consumption. The Duke was anxious, but
scarcely surprised, and recalled similar cases of a grandmother, two
ancestors, and a rackety uncle. Lady Jim encouraged these pulmonary
recollections for obvious reasons. She and Demetrius winked privately at
one another like the celebrated augurs, when they heard the old man's
lamentations. Nature was acting strictly on the lines of the Russian's
proposed medicine, and there was no need to dose Jim into a sickly likeness
of Garth. Day by day he grew as white-faced, as haggard, and as lean, until
he became alarmed at the anxiety of Providence to forward the schemes of
himself and Leah.
But there was no end to the kindness of an overruling fate. Jim's illness
afforded his wife the opportunity of posing as a sister of mercy, and she
fussed round the patient so ostentatiously, that the Duke was quite touched.
He began to think that Leah was a true ministering angel, and not the
money-wasting doll he had considered her to be. Jim grinned as Leah
measured medicine, and fed him with gruel, and read him interesting bits
from the sporting journals.
"Why so, dear?" asked his wife, who was profuse of adjectives in private,
so that they might slip out the more easily in public.
This fortunate illness kept Lady Jim at Firmingham when the house-party
disintegrated. But as the Duke was a twaddling old ass, and Jim the most
trying of patients, Leah looked upon her ten days' boredom as a kind of
Lenten penance. Besides, she had frequent confabulations with Demetrius,
to settle details of the plot. Already the doctor had explained to the Duke
that Garth would die easier in the tropics, and Funchal had been selected as
the most agreeable place for his demise.
"Those which I propose to bring about," retorted Demetrius, who had his
reasons for not explaining himself too fully.
Leah did not question him closely. With a selfish regard for her own safety,
in case anything might leak out, she preferred that the doctor should arrange
matters in his own way. But she obeyed instructions to the extent of hinting
to the Duke that Kingston was the very best place for dear Jim's weak lungs.
"Oh no," said Lady Jim, sweetly; "we mustn't make too much fuss over
him, else he'll think he's going to die."
"He might," sighed the Duke. "I had an uncle----" and he described the
sufferings of old Lord George for the tenth time.
Leah comforted him after the manner of one Bildad, a Shuhite. "Oh,
Kingston will do Jim no end of good, my dear Duke. It won't cure one lung,
but it may patch up the other. And then, you know, if he gets worse, I can
always reach him in fourteen days."
"He doesn't think poor Jim will ever be so strong as he was," said Leah,
gravely; "but he'll hang on, with care."
"Just like my grandmother," muttered the Duke, and then detailed the
sufferings of a dowager duchess, who couldn't be kept alive beyond the age
of sixty.
"If Jim lives till that age, I shall be content," said Leah.
"What insurance money? Oh yes, I think Jim did mention something about
an insurance."
"He gets it if he lives till sixty."
"Really! I don't quite understand, Duke, but I'm sure it's all right."
"Because, in the event of his dying, the insurance money should be left to
you. No will means trouble."
Leah had never thought of a will, as it seemed natural that the money
should come to her without the necessity of paying lawyers' bills. But her
quick brain seized the chance of smoothing the way to acquiring the fortune
with as little trouble as possible, and she promptly cornered the Duke. "You
speak to him," she suggested.
And this the Duke did, with the result that a will leaving the money to Leah
was drawn up and signed, after some opposition, by Jim. He did not at all
relish the carrying out of this necessary step. It was too like preparing a
death certificate to please Jim.
However, as a reward for his obedience, Demetrius set him on his legs, and
Jim went to Torquay with the devoted Leah. But when he was settled in a
comfortable hotel as an interesting invalid, and with a superfluity of pretty
girls to soothe him with sympathy, Lady Jim left him for a round of visits to
various country-houses. Now that the Duke was out of sight, Jim's
connubial comforts were out of mind; but Leah left strict injunctions that he
was not to put on flesh. Within the month, she was to see him start for
Jamaica, and impressed upon him the necessity of looking quite ready to
depart for a place where Jim had no desire to go.
"I don't see why you want to make a holy show of me," grumbled Jim.
While at Lord Sargon's seat in Shropshire, she met Askew in the company
of the fixture. The young man's betrothed was extremely like a dairy-maid,
and her frocks set Lady Jim's teeth on edge. If she could combine colours
that did not match, she always did so, and her character was as colourless as
her wardrobe was gaudy. Marjory was the creature's name, and her
conversation was the "Pa-pa!" "Mam-ma!" of a squeaking doll.
"How much are you paying for her?" asked Leah, after satisfying herself
that the young lady was really a woman.
"What a bargain!"
"Don't laugh at me," he implored; "you know there is but one woman in the
world for me."
"Some one nearer and dearer than her!" he murmured, with what the
Americans call "goo-goo" eyes, whereat Lady Jim laughed, and allowed
him to fetch and carry, and sit on his hind legs and bark prettily, like a well-
trained lap-dog. It amused her, and kept him on tenterhooks. The only
annoying thing was, that Marjory seemed to care little for this annexation of
her lover. She much preferred a fox-hunting squire, who talked "stables,"
and glowered on Askew for not appreciating the dairy-maid.
"People who need excuses for existing always do," retorted Lady Jim; "but
she is really a sweetly simple girl, with two ideas, neither of which includes
you, my dear boy. I am sure you will be very happy together, doing cake-
walks."
"Doing cake-walks?"
"That sort of dress always makes me think of South Carolina and the 'old
Kentucky home,' you know. They invented cake-walks there, I believe. But
I forgot--you prefer places below the equator."
"Of course not. The jewel is more attractive than the casket. When did you
last hear from Señorita Fajardo?"
"I don't write to her, if that is what you mean. I did love her----"
"There's nothing in that," said Lady Jim, quickly. "There never really was,
and if you really love this estancia lady, why not marry her?"
"Lady James!"
"It seems to me she has--to that intelligent young man with the face like a
sheep and the manners of a costermonger."
"And are still, from the infantile look of them. I quite expect to see their
nurse arrive. You know, it won't do," said Leah, gravely; "here I am making
fun of Marjory, and you aren't man enough to stand up for her."
The young man coloured still deeper, and mumbled something about a
woman's privilege. Shortly he made a lame excuse, and left Leah to devote
himself to Marjory, who was not grateful for the attention. Leah did not
mind. She had learned that Askew did not correspond with Lola Fajardo,
and had no intention of doing so; therefore there was little likelihood that
Jim's fettered past would ever become known at the Estancia, San Jago.
Being really a good-natured woman with her affections thoroughly under
control, Leah half decided to loosen her apron-strings and let Askew lead
his bargain to the altar. But this she did not do, for two obtrusive reasons,
firstly, the fox-hunting squire and Marjory were made for one another; and
secondly, it would be just as well to keep the sailor under her eye for the
next year. She did not wish him to hark back to Lima, for melodramatic
purposes.
After a very pleasant visit, thanks to Askew's infatuation, Lady Jim returned
to Curzon Street. There she found a letter from Demetrius announcing that
he and Garth had sailed for Madeira early in the previous week, and that it
would be as well if Lord James Kaimes journeyed forthwith to Jamaica.
Leah promptly sent an answer to her accomplice at Funchal, a telegram to
Jim, a paragraph to a society paper, and a lengthy letter of sorrowful
forebodings to the Duke. Then she sat down to wait events, and, meanwhile,
considered the situation.
Pentland was all right, thanks to her cajoling. Before she left Firmingham
he had arranged to free the income, to pay the debts, and to allow her to
occupy the Curzon Street house until such time as Jamaica should kill or
cure Jim. That interesting invalid had gone halves over the cheque, and
Leah's purse still contained over fifty pounds, which would do for the
present. But she intended to get a few hundreds from the Duke, by playing
off Jim's sickly looks and her own lonely condition of grass-widowhood. It
was really very satisfactory, and she found it hard to look miserable, as in
duty bound, when Pentland arrived to see the last of Jim. Leah arranged that
the parting between father and son should be in town. She did not want to
have a bereaved father bothering at Southampton. The journey back to town
after Jim's dispatch would be boring at the best, and her consolatory powers
were not great.
"You look disgustingly fit," said Leah, when Jim was established on the
drawing-room sofa, with a rug and a few unnecessary medicine bottles, and
other sick-room paraphernalia.
"Sorry I can't be more of a corpse," growled the invalid; "but it's not easy to
pretend you're a goner, when y' feel fit to jump over the moon."
"Shan't! It hurts m' throat. Hang it, I've lost three stone. I believe you want
me dead in real earnest."
Lady Jim thought for a moment. "No, I don't," she said, truly enough. "You
haven't treated me over well, and I should have been a different woman, had
you been a different man----"
"Divorce court lingo," said Jim, remembering what she had said at
Firmingham, and with a derisive laugh.
"All the same, I hope you'll have a good time in South America."
"Why not in Jamaica?"
"Because you've got to be thoroughly sick there. Demetrius will come along
later with Garth's corpse, and----"
"Of course," said Leah, impatiently; "but Demetrius has to embalm your
body and bring you home to the family vault."
"I say, don't," cried Jim uneasily; "that's the other Johnny you're talkin'
about. Leah," he looked round cautiously, "I hope Demetrius won't polish
off that poor fellow. He's a sort of relative of mine, y' know."
"Don't worry your head," said Lady Jim, calmly. "Garth's dying as fast as he
can; he may be dead by this time, for all we know. And don't think that I
would allow Demetrius to be so wicked," she cried, with virtuous
indignation. "I'm not a criminal."
"Oh, Lord!" was all Jim could find to say, as he thought of what they were
doing, and conversation ended for the time being. Leah went to the theatre
and supper at the Savoy that evening, leaving Jim to practise coughing
amongst the useless medicine bottles.
Next day, both Pentland and his eldest son arrived at eleven, and were
informed by a sad-faced wife that her dear husband would travel to
Southampton by the afternoon train. At the sight of Leah's dismal looks and
attentive care, Frith expressed his opinion that women were protean.
"Oh, I don't for a moment say that I think Jim is a good man," was Leah's
artistic reply; "and we've had our tiffs, like other married people. But Jim's
my husband, after all. And he has his good points."
"What are they?"
Lady Jim was not prepared with a catalogue of her husband's perfections.
"Oh, I don't know," she murmured vaguely; "he drinks in moderation, you
know. That's something."
Frith was nettled at the implied slight. "Not at all," he said, with unusual
gruffness. "Look at me."
Lady Jim left the affectionate trio together, lengthening out their farewells,
and retired, laughing, to her room. It was really amusing to think that Jim,
who was as healthy as a trout in a pond, should be wept over, and coddled,
and pitied, and generally elevated to a sainthood. The business was serious
enough, no doubt; but Leah could not help seeing the humorous side. She
felt unequal to keeping a grave face while the comedy in the drawing-room
was being played, and therefore did not rejoin her husband till the principal
comedians had departed.
"We are a couple of rotters," said Jim, gloomily, when she appeared.
"Speak for yourself, my dear," she retorted coolly. "Well, and what did they
say?"
"Never you mind. You'd only snigger over a father takin' leave of his dyin'
son."
"Oh! I did not know that the Duke had seen Harold Garth."
"Leah," cried her husband, fiercely, "you're a--never mind. Whatever you
are, I'm another."
"Did the Duke leave a cheque for me?" asked Leah, more business-like than
sympathetic.
"Dear man," cried his wife, snatching the cheque from his very reluctant
hand. "I must go and dress for the journey."
"Won't you kiss me, Leah?" quavered Jim, really moved, and quite
forgetting the rascally plot in which he was taking so prominent a part.
At the door she turned with an expression of withering scorn. "Keep your
kisses for your wife, Mr. Berring!" cried this too-previous widow, and left
him to digest the insult at his leisure.
CHAPTER XIII
The paragraph sent by Leah to her pet editor intimated concisely to the tuft-
hunting world of Tom, Dick, and Harriet, that the suddenly developed
pulmonary complaint of Lord James Kaimes necessitated his wintering in
Jamaica. This intelligence surprised the clubs, as Jim's hectoring voice and
devotion to damp field sport had always suggested aggressively sound
lungs.
"Never knew him to be chippy in his life," growled one man, who admired
Leah as much as he hated Jim for possessing her. "What's his game this
time, I wonder?"
"Perhaps he wants to get away from his wife," hinted a pigeon of Jim's
plucking. "Bit of a tongue, hasn't she?"
"Then why doesn't he stick to the one he's legally entitled to?"
"Because she sticks to him. If she'd only syndicate her admirers in the D.
C., Jim 'ud be after her like an Indian mosquito in search of a new arrival.
I'll bet there's some petticoat in this Jamaica business;" and the sportsman
looked round for some one to pander to his besetting sin--but no one gave
him a chance of committing it.
"I never knew that damnation depended upon health," was the retort. "Take
a case in point. During the Great Exhibition----"
Leah's admirer cut short a much-dreaded anecdote. "She'll make a lovely
widow."
"I don't believe in second-hand brides myself," said the horsey man,
venturing an epigram. "'Sides, her tongue--cuts like a knife. Even the mares
shy when she kicks."
"Wit! wit!" explained the admirer, who misread French memoirs. "She is
Madame de Rambouillet--without a history."
"Tut! tut!" interrupted the ancient. "Madame de Rambouillet was, and Lady
James is, entirely respectable."
"And the horse is the noblest of all animals," snapped the baronet.
"Maybe, though the beast doesn't improve your morals," and the laugh was
with the oldest inhabitant.
"Wonder if Kaimes will die," pondered the man who saw Leah as a
probable widow and a possible wife.
"You will lose; you will most assuredly lose," said the octogenarian. "Very
consumptive family, the Kaimes. And our friend is just the sort of healthy
man to depart suddenly."
"To Jim!" finished the racing man, smartly; "but I don't care. Jim, dead or
alive, is equally useless to me."
"If your play is as bad as your grammar, I prefer to stand out," said
Methuselah, and the symposium broke up, in time to prevent bickering
between crabbed age and irreverent youth.
There were many such talks during the nine minutes' wonder of Jim's
unexpected sickness, and it was generally considered that he would return
in spirits of wine to the family vault. Leah did not hear these encouraging
prognostications, so conducive to the entire success of the plot. She was
tolerating life at San Remo, under the hired roof of a truly great dame, who
wished to disentangle her from the golden nets of ultra-fast society. A grass-
widow has to be more careful to keep up appearances than the genuine
crape article, even at the risk of being bored by highly placed humanity, as
dull as stainless. Lady Hengist and her friends belonged to that seventh
heaven where newly rich Peris and the Mammons who cocker them seek
admittance in vain. Social laws differ from those of nature, inasmuch as the
gilded scum does not invariably rise to the top. Hence the creation of the
over-discussed smart set, which is taken by the suburban reader of back
stairs journalism as representative of the British aristocracy.
Well-born as Leah Kaimes was, the pleasant, if somewhat stately and stiff,
life of these genuine rulers wearied her intensely. Bread and milk is insipid
after a repast of ortolans in aspic, and a motor-flight is more exhilarating
than a donkey-ride. Moreover, it annoyed her to see how sensibly the
Hengists spent their many pounds a day. They could have had much more
fun for the money, had they known the right shops; but they patronised out-
of-date establishments, where the goods were of an excellent quality, but
just five minutes behind the newest things. Of course, this was Leah's
figurative way of saying that the Hengists came out of the Ark. They always
bought the wrong things at the wrong shops, and had a middle-class eye to
the lasting quality of the goods they purchased. They were clothed rather
than dressed, and being colour-blind, invariably chose garments which
matched abominably with their complexions. In a word, the Hengists were
so commonplace as to be original. Lady Jim could not understand why they
should have been thrust into positions which they could not fill. It was like
bringing cows into the drawing-room.
"Dean Swift said that, but he was an egotist," replied Hengist, in his serious
way, that reminded Lady Jim of Lionel at his worst. "It is more blessed to
give than to receive, you know."
"The wisest and most loving of mankind. And it is a true saying. I assure
you, that if I deny myself something I greatly desire, and send the money
which would have purchased the gratification to a charity, I feel absolutely
happy."
"Then I must make a bid for Paradise," she answered, privately thinking
that the man talked sad nonsense.
"It's a dreadful thing to be able to have the moon for the asking," went on
Hengist, reflectively.
"That's your epigrammatic way of putting it, I suppose; but the moon won't
drop from her sphere for me, howl as I may. You are very lucky to
command the planet, Lord Hengist."
"So the world thinks, but it forgets that there is the curse of satiety."
"Is there? I never knew it existed. I only wish I could cram the twelve hours
of the day with twenty-four of pleasure."
"Have you ever had everything you wished for, Lady James?"
"No!" said Leah, promptly. "I'd have the sun as well as the moon, and the
stars thrown in, if I had my way."
"Me bored--oh dear no! I am too stupid. It is only clever people like
yourself who suffer from ennui. I only wish I were a Roman empress, with
provinces for a dowry. Those dear women knew how to live."
"Who? Oh, that man who came to think he was the Roman Empire. Now
his work would bore me--I'm not stupid enough to appreciate him."
"Oh, Lord!" said Lady Jim; "as though honeymoons were not disagreeable
enough without that!" The idea made her laugh consumedly. In her mind's
eye she saw this new Paolo and Francesca reading heavy prose in ten
volumes. But Hengist did not even smile--he had absolutely no sense of
humour. Besides, he considered his companion's chatter painfully frivolous,
and sighed to think that she had such a light nature. Leah, still laughing,
glanced sideways. "I shall begin to think you are discontented, Lord
Hengist."
"I am, that I cannot do the good I should like to do. Both Julia and I wish to
benefit mankind."
"We don't want thanks, but results," said Hengist, austerely; "and we can
commence in a small way. Next summer we intend to invite five hundred
Whitechapel children to the Castle. Will you come and help us to entertain
them, Lady James?"
"Delighted," yawned Leah, for the man spoke like a copy-book; "but I hope
you'll wash them first. It will prevent disease, and give some new soap a
philanthropic advertisement."
Hengist eyed her suspiciously. He was a very, very dull young lord, large-
hearted and unintelligent, who took life so seriously that he had almost
forgotten how to laugh. England clean, England contented, England happy.
He constantly started crusades to bring on a premature millennium, and
earned his reward, after the manner of reformers, by being abused in
halfpenny newspapers as one who attempted to avert certain revolution, by
stuffing the starving with sweets. Lady Jim thought him a bore and a prig,
and too virtuous to be amusing. But that he and his wife were of use to her,
she would not have endured this presentation of his year-before-last's Tree-
of-Knowledge apples. He never plucked fresh fruit, and his Eve was quite
as blind as he in discerning up-to-date harvests. Still, Hengist was a sort of
bell-wether, leading a flock of prize sheep towards a closely guarded fold.
Leah liked the fun and money and adulation of the smart set, but she had no
notion of being a shut-out Peri from that dull paradise that the newly rich
longed for. Besides, its very dullness gave a fillip to her enjoyment of the
larky amusements of those who could not enter the sacred ark.
"I am really very fond of children," she said, to do away with the effect of
her last remark. "I wish I had some myself," and she sighed very prettily.
"Hilda Frith is more fortunate than I, with her two dear babies."
"I'm sure he would, and both Jim and I would be the very first to
congratulate him."
"Yes, poor dear! But Frith is strong and healthy, while darling Jim--oh, I
can't bear to talk about it."
This was perfectly true. To invent sentimental domestic histories and bewail
a husband she detested was difficult, even to a woman of Leah's
imagination and tact. But Hengist thought it was very good of her to talk so
generously, and paid her serious compliments till she began to think that
some unpardonable sin had thrown her into the society of this prosing
creature. It was like reading the dictionary, or drinking Homburg waters, or
paying bills. The sight of a friend made her gasp with relief, after the
manner of a pearl-diver rising to take the air.
"Here's Lady Richardson and Sir Billy," she said with a frown, for her
companion's benefit. "So horrid, to interrupt our nice conversation!"
"Oh, I don't think so," was Leah's quick reply. "It would look rude; and
then, Fanny Richardson never passes any one who will listen to her prattle
of chiffons. Besides, Billy is a nice boy--quite a little man. Don't you think
so?"
"Too much a man for his years," said her companion, austerely. "I do not
like Chesterfields in their teens. The lad's manners are too good--much too
good."
"She! She never insists on anything, except having the newest dye and the
best-cut frock, and a few dozen male ears to pour her babble into. Billy can
do no wrong in her eyes, nor in mine. He is such an admirer of women."
"Come now, even you must have made love to some pretty pastry-cook's
daughter when you were at Eton. There must be some of the old Adam in
you, Lord Hengist."
"I was never an entirely modern child," replied the serious man, evasively,
and with a sad eye on the trim figure of the rapidly approaching Billy. "To
think that he should take dinner pills, and know the difference between
sweet and dry champagne! What will the next generation be?"
The vivacious little fairy who warmly greeted Lady Jim and her solemn
escort was as pretty and fragile and dainty as a Dresden china shepherdess,
and quite a credit to the maid who re-created her every morning. There was
nothing natural about her, save her genuine adoration of Billy, and that
arose from a knowledge that royalty had made it fashionable to exploit the
nursery. Blonde and plump, jimp and graceful, dressed in perfect taste, and
coloured in the latest fashion, she was popular even with her own
discriminating sex. Hengist thought her a respectable doll, with no
particular vices, and did not object to having her at the Castle. But he
disapproved of Billy the precocious, which was decidedly unfair, as Billy
could scarcely help shaping himself to the mould into which he had been
slipped by a mother who required his assistance to play the pretty comedy
of the widow's only son.
"How are you, Leah darling? So sweet you look, and Lord Hengist too. A
most unexpected meeting, and so delightful," babbled Lady Richardson,
who talked more and said less than any society gramophone. "Billy and I
are just going to Monte Carlo, to plunge on the red. Reggy Lake is to meet
us at the station; such a nice boy--Lancers, you know--a great chum of
Billy's. Won't you come too, Leah, to brighten Billy up? He's got the hump,
poor boy, as his new nerve-tonic doesn't suit him, and such a lovely, lovely
day as it is too. Don't you think so, Lord Hengist?"
The respectable Hengist's hair bristled at this incoherent speech, and did not
lie down again at the look in Billy's eyes. Dressed in a particularly smart
Eton suit, gloved and silk-hatted and patent-leather-booted with fashionable
accuracy, the boy appraised Lady Jim's beauty in a calm way, which would
have made a captain of dragoons blush. Behind his graceful, nonchalant,
handsome mask of youth was hidden an old, old man, and in many ways
Hengist was his junior. He certainly blushed when Leah gave him an
amused glance, but this was Billy's way of mashing the sex. He knew the
value of youthful diffidence, backed by mature knowledge.
"Should not your little boy be at school?" asked Hengist, scandalised into
an implied snub.
Sir William looked at the troubled face of his elder with the serenity of a
cherub. "Goin' back nex' week," said he, carefully dropping his "g's." "Th'
little mother wanted me to look after her for a bit."
"Billy can't trust me out of his sight," giggled Lady Richardson. "He's so
afraid I'll give him a second father."
"What's a rotter, Sir Billy?" asked Lady Jim, enjoying the disgusted looks of
Hengist.
The wink and the speech were lost on Hengist, for he was being worried by
Lady Richardson. She danced before him, a pretty figure gowned in burnt-
almond red, and would have distracted his heart with daintiness but that
Julia kept that article in the nursery.
"Do join us, Lord Hengist," she pleaded seductively. "Such fun, when you
know the ropes. Billy can show them to you."
"Now you are horrid," said the widow, who did not know in the least what
he meant. "I'll tell your wife. By the way, how is she, and the darling,
darling twins? Twins are too sweet. I wish Billy was a twin."
"I'm sure I don't know what you are talking about, and it's very horrid of
you to say so. Billy is adored."
Lady Richardson gave a scream. "How barbarous! The man who tried to
whip Billy would have to order his coffin beforehand. Billy can handle his
bunches of fives, I can tell you, Lord Hengist."
"His what?"
"It's Billy's way of putting boxing. You should see him give the postman's
knock! Oh, he is clever! He can drive a motor, too, and pick out the winner
five times out of ten."
"What's that?" asked Leah, overhearing the names; "the Russian man?"
"Stiff sort of fella'!" said young Eton. "Nothin' birdish about him.
Daughter's a clipper, though. Say, little mother, we'd best get. Th' train won't
wait, y' know."
Before he had finished speaking Lady Jim had made up her mind. She had
not heard from Demetrius, and it was not impossible that he had written to
Katinka. In spite of his discouraging love-making he kept in with her, on
the chance that she might be able to procure his pardon, and in any case she
was useful in keeping him posted in the doings of the Third Section. The
girl was so infatuated that she never saw he was making use of her in this
way, and constantly wrote to him about any official gossip she heard. There
was something pathetic in her devotion and heart-whole love for the man
who deceived her. But Leah did not look at the matter in this way. She knew
that Katinka, if any one, would have news of the doctor, and being anxious
to learn how Garth was progressing towards the grave, she turned to
Hengist.
"I think I'll go over," she said in a low voice. "Jim asked me to see M.
Aksakoff on some business. Would Julia mind?"
"Not at all," said Hengist, heartily, and quite deceived. "I would escort you,
only I have some letters to write about the distress in London."
"Oh, Billy will look after us," said that young gentleman's mother.
"I have driven a team before now," observed Billy, with dignity.
I Hengist gave him a reproving look (which Billy bore very stoically), and
whispered to Leah as they parted, "Don't encourage that lad."
"I don't think he needs much encouragement," said Lady Jim, laughing, and
the two women walked away with Billy between them. Hengist stood where
he was and frowned.
CHAPTER XIV
"Then I should make him wait five hours," replied Leah, calmly. "It doesn't
do to spoil men."
"Pooh! You are merely a rascal in the making. I wouldn't hint how we
govern your sex, if you were anything but a grub."
"I haven't the heart or the muscle, my dear. The only safe thing will be to
marry a strong man with a bad temper."
"I should jolly well like to see the stepfather who would pitch into me."
"You will, if you don't behave. Isn't that eyebrow a little crooked, Billy?"
and she fingered it delicately.
"Don't think so; but you have a smudge of powder on your chin."
"So I have. How horrid! There!" dusting it off. "What a comfort you are to
your darling mammy, my own! Kiss me."
Billy brushed her rouge with careful lips, and after a glance to see that he
had not blurred the picture, Lady Richardson put away the mirror.
"Thank goodness, we're moving again," she prattled. "I do hope Reggy
won't be in a bad temper."
"I'll square that, little mother. Been to the theatres lately, Lady Jim?"
"No," answered Leah, amused by his man-about-town air. "Is there anything
good on?"
Billy was obviously shocked. "No woman should see that piece. I can stand
heaps, but----" an after-me-the-deluge shrug hinted at the degradation of the
drama.
"Yes, poor darling," chimed in his mother; "he was blushing three inches
deep all over when he came home."
"I am glad to hear that Billy can blush at all," murmured Lady Jim. "How's
the betting, William?"
"Sixteen, and thinks he's twenty. Awfully saucy chap though. Went nap on a
girl, and another fella' scooped th' pool."
"Don't they teach English at Eton, Billy?"
The youth was quite undisturbed. "Try to," he assured her; "but there's no
snap about the classical rot they give us. Oh, here we are."
"And there is Reggy," cried Lady Richardson, craning her dyed head out of
the window like another Jezebel. "How d'y do, Captain Lake? Lovely day!
So sorry we're late. You know Lady James Kaimes?"
"I have that pleasure," said the tall young soldier, saluting. "Very sorry to
hear your husband is ill, Lady James."
"Thanks! But I daresay Jamaica will pull him round, Captain Lake."
"It was different in your youth, no doubt. But I am not a girl, and quite old
enough to box the ears of conceited urchins."
"What precocious Christianity! You had better apply to that pretty American
girl near the Casino door."
"Miss Mamie Mulrady? Oh, I can get her kisses without fightin'. Not bad-
lookin', is she? Lots of tin, an' as spry as they make 'em. There's th' little
mother an' that rotter chippin' into th' Casino. Shall we follow, Lady Jim?"
They were stopped on the steps by Miss Mulrady, "who knew both, and
claimed acquaintance through a wholly unnecessary lorgnette. She was a
vivacious Wild West product, who exaggerated the vernacular, because
Europeans expected to find the Californian girl of fiction in real life. Her
exaggerated slang was assumed out of sheer amusement, and she greatly
enjoyed the amazed looks of those who heard her talk good Anglo-Saxon,
which she did, when she escaped from fools to forgather with wise men.
"Keepin' afloat, I guess, but that's about all. The dollars I've lost buckin' the
tiger would have bought me a dozen husbands."
"Foreign ones are cheap, I believe," said Leah, admiring the prairie-flower's
Paris frock more than her republican manner.
"You make me smile. I'm goin' to run tandem with Sir Billy here--me first
and he the wheeler."
"No go," said the boy, quite able to hold his own. "I'm not goin' to marry a
Bret Harte girl."
"Oh, do," replied Miss Mulrady, in the purest of English, and placing two
small gloved hands together. "I'll be a wife and a mother in one."
"What economy!" smiled Lady Jim. "Are you coming into the 'devil's
parlour'?"
Leah started. She thought that Askew was safe in Shropshire, making
attempts to civilise the fixture. "Harry Askew?"
"That's so," assented Miss Mulrady, relapsing into her Wild West
vocabulary, and with a keen look. "He called on Mommo an' me, when he
was cruisin' out 'Frisco way. We're negotiatin' a system to break this old
bank."
"Shouldn't wonder. We ticket our sins best sugar. Sir Billy, come along an'
buy me candy at the stores."
"Lady Jim an' I 'ull swap humans. What say?" and she looked at Leah,
mischievously overdoing the slang.
"I never swap what isn't my own property," answered Lady Jim, considering
this offer too Western, and resenting the familiarity to the extent of walking
into the Casino with her head very much in the air. America could hold her
own with the mother-country, and Leah did not approve.
"She wants to be the whole show an' the box-office," murmured Mamie,
mischievously. "Stay here, Bub."
"I am sorry to refuse a lady," replied Billy, resenting the word; "but I've put
my money on Lady Jim, this trip."
"On the red--hair, you mean. Go bye-bye with your nurse, then. Here's Mr.
Askew, he's older than you."
"And easier to please," snapped the youth, much offended. "You'll excuse
me, Miss Mulrady, but a man can't keep a woman waitin'."
He retired into what Lady Jim called the "devil's parlour" with a Floreat
Etona air, and Miss Mulrady, after a glance at the ears which she longed to
box soundly, turned to receive a breathless apology from the belated Askew.
"There's a friend of yours gone in to sin for an hour," said she, when a treaty
was concluded.
"Visitin' the sick an' the poor," said Mamie, shrewdly. "It's what folks come
to Monte for. Guess, she best drop in on you--a sicker man I never saw, an'
you'll be poor enough by th' time we're through with this old system of
yours. I know a bank where th' wild time goes. You may look all through
Bacon without findin' that remark--it's my own. Let's get."
Thus, with barbaric japes, did the child of nature lead her companion into
the gilded halls of iniquity, and the two jostled the well-dressed crowd
which circulated round the tables. The silence was that of an arctic night,
save for the droning voices of the croupiers, and at times a hurried whisper
of joy or dismay.
"Goin' in for rouge et noir with Lady Jim?" asked Miss Mulrady, alluding to
the hair of Askew and his friend; "or perhaps she's sportin' on trente et
quarante, to suit her years."
"Try the system, then;" and Askew pushed his way through the Mammon-
worshippers to where the roulette ball wheeled its fatal round.
Lady Jim did not play. She had stupidly forgotten her peacock's feather and
could not risk loss with her small capital. But Billy, having the audacity and
luck of innocence, was at hand, so she gave him five hundred francs to
experiment.
Katinka Aksakoff grew crimson when Lady Jim saluted her, and would
have evaded the meeting if possible. She might have been a nun from the
looks of her, and was garbed in unrelieved black, which Leah concluded
was mourning for unrequited affection. After that fleeting wave of colour,
her thin, oval face grew marble white, and a pair of dark questioning eyes
appeared twice as large and three times as brilliant as they had been before
resting on Lady Jim's gracious smile.
"So glad to meet you," murmured Leah, as they shook hands in the air.
"Lady Richardson and I have come to tea. Where is your father?"
"Oh yes," rejoined Lady Jim, with perfect good-humour. "When you learn
how you misjudge me, we shall get on capitally."
"Probably not, since I have yet to make my explanation. Let us walk on the
terrace, and you can throw me over, to where they shoot the pigeons, if my
conversation displeases you."
Leah's eyes rested appreciatively on the varied beauty of God's work and
man's improvements. The huddled white houses of Monaco crowned its
giant rock, which bulked hugely against the blended azure of sea and sky.
The placid waters ringed its base with foam, and stretched with sparks and
dashes of fire towards an immeasurable horizon. Landward bunched the red
roofs of the town, below arid and precipitous heights, soaring massively
into the radiant and ever-deepening blue. A balmy wind, like some invisible
alchemist, changed the sombre green of the olive-groves to patches of
glittering silver. Near at hand spread the lustrous foliage of lemon- and
orange-trees, nor was wanting the almond-blossom of the far east. They
walked under palms suggestive of Bedouin life, and, to the well-read, of
Heine's sad little song, immortal and heart-rendingly true. Roses and
violets, and flowers of many shapes and hues, bordered the terrace; the
wide sea laughed at their feet, and behind them rose the palatial structure of
the Casino, gorgeous as the Golden House of Nero. It was Fairyland, and
Lady Jim said so to her sad companion, who was too blinded by love to see
beauty anywhere when the beloved was absent.
"We can talk in French, if you like," said Leah, after she had paid her tribute
to nature.
"In English, I think," replied the Russian girl; "my father wishes me to
speak only your tongue, while we remain in London, so that I may
improve."
"We're too busy annexing the world to bother about philological lessons,"
said Lady Jim, remembering Heine's remark anent the Romans.
"I fancy nothing," interrupted the other, haughtily. "Words are not needed
where he is concerned."
Katinka flushed painfully, and she put her hand suddenly to her throat.
"Nonsense. We are not in Russia, where people kneel down and say please.
Besides, it is necessary for your peace of mind that you should hear what I
have to say."
"I am trying to be. You think that I love Demetrius, and that he is devoted to
me. It is not so."
Katinka winced. She did not like such plain speaking, and, moreover,
doubted its truth. "If I could think so, I would----"
"Of course you can think so," said Lady Jim, amiably. "Demetrius is
particularly clever in curing consumptive diseases. For that reason I
conversed with him a great deal. My husband is very ill, and I wanted the
doctor to cure him. If Demetrius thought that my liking for his society
meant anything else, he is an egotist. My advice is, that you should procure
his pardon and marry him."
"I am!" and the eyes of the two women met. Katinka searched the hard blue
orbs of the great lady with painful intensity, and Leah bore the scrutiny with
the knowledge that her conduct had been, and always would be, perfectly
correct. Had she been the least in love with the doctor, she would not have
dared to submit to that probing, painful gaze. Women may deceive mere
men; they cannot deceive one another, especially in affairs of the heart.
When Katinka withdrew her eyes she was satisfied that Lady Jim cared
nothing for Demetrius. Without explanation, she burst into rapid and
wrathful speech, and Leah's feminine perspicacity enabled her to guess the
unuttered preamble, which a man would have required to be put into words.
"Why then do you lure him to your feet?" cried the Russian girl, in a sharp,
pained voice. "If you love him not, why torture him, and me? I know he
loves you--I know--I know--oh yes, I know."
"You do not. His love for me--if it can be called so--is the mere passing
fancy of a man for a woman who has been kind to him."
"Not at all. But men are so conceited that they think a woman's smile means
a woman's love. You have a golden heart, yet you throw it into the greedy
hands of this selfish egotist----"
"No, I don't. Men are far vainer than women, and women more selfish than
men. I'm selfish myself, therefore I am happy. You are one of those self-
tormenting, self-denying angels, who make men what they are--vain,
greedy, conceited, lord-of-creation beasts. And I insult the beasts by such a
comparison."
"I use them, and I detest them," retorted Lady Jim, speaking more plainly
than was her custom. "There are good men--I don't deny that, for I know
one at least"--she was thinking of Lionel; "but the majority--ugh! God help
the women like yourself, who give their hearts into the keeping of such
animals!"
"We all love our husbands--it's part of the Church Service to love them.
Pah!--I am not here to talk of my marriage, but of yours. You know now
that I don't care for Demetrius, and that I desired his help merely for my
husband's sake."
"Yes. I have wronged you;" and Katinka put out her hand.