100% found this document useful (2 votes)
251 views

(eBook PDF) Java How to Program, Late Objects Global Edition 11th Editioninstant download

The document provides links to various eBook PDFs related to Java and C++ programming, including titles like 'Java How to Program, Late Objects' and 'C++ How to Program'. It also includes a disclaimer regarding trademarks and the suitability of the information provided. The content outlines the structure of the books, including chapters on programming concepts, control statements, and object-oriented programming.

Uploaded by

lapdezimesch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
251 views

(eBook PDF) Java How to Program, Late Objects Global Edition 11th Editioninstant download

The document provides links to various eBook PDFs related to Java and C++ programming, including titles like 'Java How to Program, Late Objects' and 'C++ How to Program'. It also includes a disclaimer regarding trademarks and the suitability of the information provided. The content outlines the structure of the books, including chapters on programming concepts, control statements, and object-oriented programming.

Uploaded by

lapdezimesch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

(eBook PDF) Java How to Program, Late Objects

Global Edition 11th Edition download

https://ebookluna.com/product/ebook-pdf-java-how-to-program-late-
objects-global-edition-11th-edition/

Download more ebook from https://ebookluna.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookluna.com
to discover even more!

(eBook PDF) Java How To Program (Early Objects) 10th

https://ebookluna.com/product/ebook-pdf-java-how-to-program-early-
objects-10th/

(eBook PDF) Java How to Program, Early Objects 11th Edition by Paul J.
Deitel

https://ebookluna.com/product/ebook-pdf-java-how-to-program-early-
objects-11th-edition-by-paul-j-deitel/

(eBook PDF) Java Concepts: Late Objects, 3rd Edition

https://ebookluna.com/product/ebook-pdf-java-concepts-late-objects-3rd-
edition/

(eBook PDF) Big Java Late Objects 2nd Edition

https://ebookluna.com/product/ebook-pdf-big-java-late-objects-2nd-edition/
C++ How to Program: An Objects-Natural Approach, 11e 11th Edition Paul
Deitel - eBook PDF

https://ebookluna.com/download/c-how-to-program-an-objects-natural-
approach-11e-ebook-pdf/

C++ How to Program Early Objects Version 9th Edition (eBook PDF)

https://ebookluna.com/product/c-how-to-program-early-objects-version-9th-
edition-ebook-pdf/

C How to Program, 9th Global Edition Deitel Paul - eBook PDF

https://ebookluna.com/download/c-how-to-program-9th-global-edition-ebook-
pdf/

(eBook PDF) Big C++: Late Objects 3rd Edition

https://ebookluna.com/product/ebook-pdf-big-c-late-objects-3rd-edition/

(eBook PDF) Brief C++: Late Objects, 3rd Edition

https://ebookluna.com/product/ebook-pdf-brief-c-late-objects-3rd-edition/
Trademarks
DEITEL and the double-thumbs-up bug are registered trademarks of Deitel and Associates, Inc.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks
of their respective owners.
Microsoft and/or its respective suppliers make no representations about the suitability of the information
contained in the documents and related graphics published as part of the services for any purpose. All
such documents and related graphics are provided “as is” without warranty of any kind. Microsoft and/
or its respective suppliers hereby disclaim all warranties and conditions with regard to this information,
including all warranties and conditions of merchantability, whether express, implied or statutory, fitness
for a particular purpose, title and non-infringement. In no event shall Microsoft and/or its respective sup-
pliers be liable for any special, indirect or consequential damages or any damages whatsoever resulting
from loss of use, data or profits, whether in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of information available from the services.
The documents and related graphics contained herein could include technical inaccuracies or typograph-
ical errors. Changes are periodically added to the information herein. Microsoft and/or its respective sup-
pliers may make improvements and/or changes in the product(s) and/or the program(s) described herein
at any time. Partial screen shots may be viewed in full within the software version specified.
Microsoft® and Windows® are registered trademarks of the Microsoft Corporation in the U.S.A. and
other countries. Screen shots and icons reprinted with permission from the Microsoft Corporation. This
book is not sponsored or endorsed by or affiliated with the Microsoft Corporation.
UNIX is a registered trademark of The Open Group.
Apache is a trademark of The Apache Software Foundation.
CSS and XML are registered trademarks of the World Wide Web Consortium.
Firefox is a registered trademark of the Mozilla Foundation.
Google is a trademark of Google, Inc.
Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other countries.
Linux is a registered trademark of Linus Torvalds. All trademarks are property of their respective owners.
Throughout this book, trademarks are used. Rather than put a trademark symbol in every occurrence of
a trademarked name, we state that we are using the names in an editorial fashion only and to the benefit
of the trademark owner, with no intention of infringement of the trademark.
Contents
The online chapters and appendices listed at the end of this Table of Contents are located
on the book’s Companion Website (http://www.pearsonglobaleditions.com)—see
the inside front cover of your book for details.

Foreword 25

Preface 27

Before You Begin 47

1 Introduction to Computers, the Internet and Java 53


1.1 Introduction 54
1.2 Hardware and Software 56
1.2.1 Moore’s Law 56
1.2.2 Computer Organization 57
1.3 Data Hierarchy 59
1.4 Machine Languages, Assembly Languages and High-Level Languages 61
1.5 Basic Introduction to Object Terminology 62
1.5.1 Automobile as an Object 63
1.5.2 Methods and Classes 63
1.5.3 Instantiation 63
1.5.4 Reuse 63
1.5.5 Messages and Method Calls 64
1.5.6 Attributes and Instance Variables 64
1.5.7 Encapsulation and Information Hiding 64
1.5.8 Inheritance 64
1.5.9 Interfaces 65
1.5.10 Object-Oriented Analysis and Design (OOAD) 65
1.5.11 The UML (Unified Modeling Language) 65
1.6 Operating Systems 66
1.6.1 Windows—A Proprietary Operating System 66
1.6.2 Linux—An Open-Source Operating System 66
1.6.3 Apple’s macOS and Apple’s iOS for iPhone®, iPad® and
iPod Touch® Devices 67
1.6.4 Google’s Android 67
8 Contents

1.7 Programming Languages 68


1.8 Java 70
1.9 A Typical Java Development Environment 71
1.10 Test-Driving a Java Application 74
1.11 Internet and World Wide Web 78
1.11.1 Internet: A Network of Networks 79
1.11.2 World Wide Web: Making the Internet User-Friendly 79
1.11.3 Web Services and Mashups 79
1.11.4 Internet of Things 80
1.12 Software Technologies 81
1.13 Getting Your Questions Answered 83

2 Introduction to Java Applications; Input/Output


and Operators 87
2.1 Introduction 88
2.2 Your First Program in Java: Printing a Line of Text 88
2.2.1 Compiling the Application 92
2.2.2 Executing the Application 93
2.3 Modifying Your First Java Program 94
2.4 Displaying Text with printf 96
2.5 Another Application: Adding Integers 97
2.5.1 import Declarations 98
2.5.2 Declaring and Creating a Scanner to Obtain User Input
from the Keyboard 98
2.5.3 Prompting the User for Input 99
2.5.4 Declaring a Variable to Store an Integer and Obtaining an
Integer from the Keyboard 99
2.5.5 Obtaining a Second Integer 100
2.5.6 Using Variables in a Calculation 100
2.5.7 Displaying the Calculation Result 100
2.5.8 Java API Documentation 101
2.5.9 Declaring and Initializing Variables in Separate Statements 101
2.6 Memory Concepts 101
2.7 Arithmetic 102
2.8 Decision Making: Equality and Relational Operators 106
2.9 Wrap-Up 109

3 Control Statements: Part 1; Assignment,


++ and -- Operators 120
3.1 Introduction 121
3.2 Algorithms 121
3.3 Pseudocode 122
3.4 Control Structures 122
3.4.1 Sequence Structure in Java 123
Contents 9

3.4.2 Selection Statements in Java 124


3.4.3 Iteration Statements in Java 124
3.4.4 Summary of Control Statements in Java 124
3.5 if Single-Selection Statement 125
3.6 if…else Double-Selection Statement 126
3.6.1 Nested if…else Statements 127
3.6.2 Dangling-else Problem 128
3.6.3 Blocks 128
3.6.4 Conditional Operator (?:) 129
3.7 while Iteration Statement 129
3.8 Formulating Algorithms: Counter-Controlled Iteration 131
3.9 Formulating Algorithms: Sentinel-Controlled Iteration 135
3.10 Formulating Algorithms: Nested Control Statements 142
3.11 Compound Assignment Operators 146
3.12 Increment and Decrement Operators 147
3.13 Primitive Types 150
3.14 Wrap-Up 150

4 Control Statements: Part 2; Logical Operators 164


4.1 Introduction 165
4.2 Essentials of Counter-Controlled Iteration 165
4.3 for Iteration Statement 166
4.4 Examples Using the for Statement 170
4.4.1 Application: Summing the Even Integers from 2 to 20 171
4.4.2 Application: Compound-Interest Calculations 172
4.5 do…while Iteration Statement 175
4.6 switch Multiple-Selection Statement 176
4.7 break and continue Statements 182
4.7.1 break Statement 182
4.7.2 continue Statement 182
4.8 Logical Operators 183
4.8.1 Conditional AND (&&) Operator 184
4.8.2 Conditional OR (||) Operator 184
4.8.3 Short-Circuit Evaluation of Complex Conditions 185
4.8.4 Boolean Logical AND (&) and Boolean Logical Inclusive OR (|)
Operators 185
4.8.5 Boolean Logical Exclusive OR (^) 186
4.8.6 Logical Negation (!) Operator 186
4.8.7 Logical Operators Example 187
4.9 Structured-Programming Summary 189
4.10 Wrap-Up 194

5 Methods 204
5.1 Introduction 205
10 Contents

5.2 Program Units in Java 205


5.3 static Methods, static Variables and Class Math 207
5.4 Declaring Methods 209
5.5 Notes on Declaring and Using Methods 213
5.6 Method-Call Stack and Activation Records 214
5.6.1 Method-Call Stack 214
5.6.2 Stack Frames 214
5.6.3 Local Variables and Stack Frames 215
5.6.4 Stack Overflow 215
5.7 Argument Promotion and Casting 215
5.8 Java API Packages 216
5.9 Case Study: Secure Random-Number Generation 218
5.10 Case Study: A Game of Chance; Introducing enums 223
5.11 Scope of Declarations 227
5.12 Method Overloading 230
5.12.1 Declaring Overloaded Methods 230
5.12.2 Distinguishing Between Overloaded Methods 231
5.12.3 Return Types of Overloaded Methods 231
5.13 Wrap-Up 232

6 Arrays and ArrayLists 245


6.1 Introduction 246
6.2 Primitive Types vs. Reference Types 247
6.3 Arrays 247
6.4 Declaring and Creating Arrays 249
6.5 Examples Using Arrays 250
6.5.1 Creating and Initializing an Array 250
6.5.2 Using an Array Initializer 251
6.5.3 Calculating the Values to Store in an Array 252
6.5.4 Summing the Elements of an Array 253
6.5.5 Using Bar Charts to Display Array Data Graphically 254
6.5.6 Using the Elements of an Array as Counters 256
6.5.7 Using Arrays to Analyze Survey Results 257
6.6 Exception Handling: Processing the Incorrect Response 259
6.6.1 The try Statement 259
6.6.2 Executing the catch Block 259
6.6.3 toString Method of the Exception Parameter 260
6.7 Enhanced for Statement 260
6.8 Passing Arrays to Methods 261
6.9 Pass-By-Value vs. Pass-By-Reference 264
6.10 Multidimensional Arrays 264
6.10.1 Arrays of One-Dimensional Arrays 265
6.10.2 Two-Dimensional Arrays with Rows of Different Lengths 265
6.10.3 Creating Two-Dimensional Arrays with Array-Creation
Expressions 266
Contents 11

6.10.4 Two-Dimensional Array Example: Displaying Element Values 266


6.10.5 Common Multidimensional-Array Manipulations Performed
with for Statements 267
6.11 Variable-Length Argument Lists 268
6.12 Using Command-Line Arguments 269
6.13 Class Arrays 271
6.14 Introduction to Collections and Class ArrayList 274
6.15 Wrap-Up 278

7 Introduction to Classes and Objects 298


7.1 Introduction 299
7.2 Instance Variables, set Methods and get Methods 300
7.2.1 Account Class with an Instance Variable, and set and get Methods 300
7.2.2 AccountTest Class That Creates and Uses an Object of
Class Account 302
7.2.3 Compiling and Executing an App with Multiple Classes 305
7.2.4 Account UML Class Diagram 305
7.2.5 Additional Notes on Class AccountTest 306
7.2.6 Software Engineering with private Instance Variables and
public set and get Methods 307
7.3 Default and Explicit Initialization for Instance Variables 308
7.4 Account Class: Initializing Objects with Constructors 309
7.4.1 Declaring an Account Constructor for Custom Object
Initialization 309
7.4.2 Class AccountTest: Initializing Account Objects When
They’re Created 310
7.5 Account Class with a Balance 312
7.5.1 Account Class with a balance Instance Variable of Type double 312
7.5.2 AccountTest Class to Use Class Account 313
7.6 Case Study: Card Shuffling and Dealing Simulation 316
7.7 Case Study: Class GradeBook Using an Array to Store Grades 320
7.8 Case Study: Class GradeBook Using a Two-Dimensional Array 326
7.9 Wrap-Up 331

8 Classes and Objects: A Deeper Look 339


8.1 Introduction 340
8.2 Time Class Case Study 340
8.3 Controlling Access to Members 345
8.4 Referring to the Current Object’s Members with the this Reference 346
8.5 Time Class Case Study: Overloaded Constructors 348
8.6 Default and No-Argument Constructors 353
8.7 Notes on Set and Get Methods 354
8.8 Composition 355
8.9 enum Types 358
12 Contents

8.10 Garbage Collection 361


8.11 static Class Members 361
8.12 static Import 365
8.13 final Instance Variables 366
8.14 Package Access 367
8.15 Using BigDecimal for Precise Monetary Calculations 368
8.16 (Optional) GUI and Graphics Case Study: Using Objects with Graphics 371
8.17 Wrap-Up 375

9 Object-Oriented Programming: Inheritance 383


9.1 Introduction 384
9.2 Superclasses and Subclasses 385
9.3 protected Members 387
9.4 Relationship Between Superclasses and Subclasses 388
9.4.1 Creating and Using a CommissionEmployee Class 388
9.4.2 Creating and Using a BasePlusCommissionEmployee Class 393
9.4.3 Creating a CommissionEmployee–BasePlusCommissionEmployee
Inheritance Hierarchy 398
9.4.4 CommissionEmployee–BasePlusCommissionEmployee
Inheritance Hierarchy Using protected Instance Variables 401
9.4.5 CommissionEmployee–BasePlusCommissionEmployee Inheritance
Hierarchy Using private Instance Variables 404
9.5 Constructors in Subclasses 408
9.6 Class Object 409
9.7 Designing with Composition vs. Inheritance 410
9.8 Wrap-Up 412

10 Object-Oriented Programming: Polymorphism


and Interfaces 417
10.1 Introduction 418
10.2 Polymorphism Examples 420
10.3 Demonstrating Polymorphic Behavior 421
10.4 Abstract Classes and Methods 423
10.5 Case Study: Payroll System Using Polymorphism 426
10.5.1 Abstract Superclass Employee 427
10.5.2 Concrete Subclass SalariedEmployee 429
10.5.3 Concrete Subclass HourlyEmployee 431
10.5.4 Concrete Subclass CommissionEmployee 432
10.5.5 Indirect Concrete Subclass BasePlusCommissionEmployee 434
10.5.6 Polymorphic Processing, Operator instanceof and Downcasting 435
10.6 Allowed Assignments Between Superclass and Subclass Variables 440
10.7 final Methods and Classes 440
10.8 A Deeper Explanation of Issues with Calling Methods from Constructors 441
10.9 Creating and Using Interfaces 442
10.9.1 Developing a Payable Hierarchy 444
Contents 13

10.9.2 Interface Payable 445


10.9.3 Class Invoice 445
10.9.4 Modifying Class Employee to Implement Interface Payable 447
10.9.5 Using Interface Payable to Process Invoices and Employees
Polymorphically 449
10.9.6 Some Common Interfaces of the Java API 450
10.10 Java SE 8 Interface Enhancements 451
10.10.1 default Interface Methods 451
10.10.2 static Interface Methods 452
10.10.3 Functional Interfaces 452
10.11 Java SE 9 private Interface Methods 453
10.12 private Constructors 453
10.13 Program to an Interface, Not an Implementation 454
10.13.1 Implementation Inheritance Is Best for Small Numbers of
Tightly Coupled Classes 454
10.13.2 Interface Inheritance Is Best for Flexibility 454
10.13.3 Rethinking the Employee Hierarchy 455
10.14 (Optional) GUI and Graphics Case Study: Drawing with Polymorphism 456
10.15 Wrap-Up 458

11 Exception Handling: A Deeper Look 465


11.1 Introduction 466
11.2 Example: Divide by Zero without Exception Handling 467
11.3 Example: Handling ArithmeticExceptions and
InputMismatchExceptions 469
11.4 When to Use Exception Handling 475
11.5 Java Exception Hierarchy 475
11.6 finally Block 479
11.7 Stack Unwinding and Obtaining Information from an Exception 483
11.8 Chained Exceptions 486
11.9 Declaring New Exception Types 488
11.10 Preconditions and Postconditions 489
11.11 Assertions 489
11.12 try-with-Resources: Automatic Resource Deallocation 491
11.13 Wrap-Up 492

12 JavaFX Graphical User Interfaces: Part 1 498


12.1 Introduction 499
12.2 JavaFX Scene Builder 500
12.3 JavaFX App Window Structure 501
12.4 Welcome App—Displaying Text and an Image 502
12.4.1 Opening Scene Builder and Creating the File Welcome.fxml 502
12.4.2 Adding an Image to the Folder Containing Welcome.fxml 503
12.4.3 Creating a VBox Layout Container 503
12.4.4 Configuring the VBox Layout Container 504
12.4.5 Adding and Configuring a Label 504
14 Contents

12.4.6 Adding and Configuring an ImageView 505


12.4.7 Previewing the Welcome GUI 507
12.5 Tip Calculator App—Introduction to Event Handling 507
12.5.1 Test-Driving the Tip Calculator App 508
12.5.2 Technologies Overview 509
12.5.3 Building the App’s GUI 511
12.5.4 TipCalculator Class 518
12.5.5 TipCalculatorController Class 520
12.6 Features Covered in the Other JavaFX Chapters 525
12.7 Wrap-Up 525

13 JavaFX GUI: Part 2 533


13.1 Introduction 534
13.2 Laying Out Nodes in a Scene Graph 534
13.3 Painter App: RadioButtons, Mouse Events and Shapes 536
13.3.1 Technologies Overview 536
13.3.2 Creating the Painter.fxml File 538
13.3.3 Building the GUI 538
13.3.4 Painter Subclass of Application 541
13.3.5 PainterController Class 542
13.4 Color Chooser App: Property Bindings and Property Listeners 546
13.4.1 Technologies Overview 546
13.4.2 Building the GUI 547
13.4.3 ColorChooser Subclass of Application 549
13.4.4 ColorChooserController Class 550
13.5 Cover Viewer App: Data-Driven GUIs with JavaFX Collections 552
13.5.1 Technologies Overview 553
13.5.2 Adding Images to the App’s Folder 553
13.5.3 Building the GUI 553
13.5.4 CoverViewer Subclass of Application 555
13.5.5 CoverViewerController Class 555
13.6 Cover Viewer App: Customizing ListView Cells 557
13.6.1 Technologies Overview 558
13.6.2 Copying the CoverViewer App 558
13.6.3 ImageTextCell Custom Cell Factory Class 559
13.6.4 CoverViewerController Class 560
13.7 Additional JavaFX Capabilities 561
13.8 JavaFX 9: Java SE 9 JavaFX Updates 563
13.9 Wrap-Up 565

14 Strings, Characters and Regular Expressions 574


14.1 Introduction 575
14.2 Fundamentals of Characters and Strings 575
14.3 Class String 576
14.3.1 String Constructors 576
Contents 15

14.3.2 String Methods length, charAt and getChars 577


14.3.3 Comparing Strings 579
14.3.4 Locating Characters and Substrings in Strings 583
14.3.5 Extracting Substrings from Strings 585
14.3.6 Concatenating Strings 586
14.3.7 Miscellaneous String Methods 587
14.3.8 String Method valueOf 588
14.4 Class StringBuilder 589
14.4.1 StringBuilder Constructors 590
14.4.2 StringBuilder Methods length, capacity, setLength and
ensureCapacity 591
14.4.3 StringBuilder Methods charAt, setCharAt, getChars and
reverse 592
14.4.4 StringBuilder append Methods 593
14.4.5 StringBuilder Insertion and Deletion Methods 595
14.5 Class Character 596
14.6 Tokenizing Strings 601
14.7 Regular Expressions, Class Pattern and Class Matcher 602
14.7.1 Replacing Substrings and Splitting Strings 607
14.7.2 Classes Pattern and Matcher 609
14.8 Wrap-Up 611

15 Files, Input/Output Streams, NIO and


XML Serialization 622
15.1 Introduction 623
15.2 Files and Streams 623
15.3 Using NIO Classes and Interfaces to Get File and Directory Information 625
15.4 Sequential Text Files 629
15.4.1 Creating a Sequential Text File 629
15.4.2 Reading Data from a Sequential Text File 632
15.4.3 Case Study: A Credit-Inquiry Program 633
15.4.4 Updating Sequential Files 638
15.5 XML Serialization 638
15.5.1 Creating a Sequential File Using XML Serialization 638
15.5.2 Reading and Deserializing Data from a Sequential File 644
15.6 FileChooser and DirectoryChooser Dialogs 645
15.7 (Optional) Additional java.io Classes 651
15.7.1 Interfaces and Classes for Byte-Based Input and Output 651
15.7.2 Interfaces and Classes for Character-Based Input and Output 653
15.8 Wrap-Up 654

16 Generic Collections 662


16.1 Introduction 663
16.2 Collections Overview 663
16 Contents

16.3 Type-Wrapper Classes 665


16.4 Autoboxing and Auto-Unboxing 665
16.5 Interface Collection and Class Collections 665
16.6 Lists 666
16.6.1 ArrayList and Iterator 667
16.6.2 LinkedList 669
16.7 Collections Methods 674
16.7.1 Method sort 674
16.7.2 Method shuffle 678
16.7.3 Methods reverse, fill, copy, max and min 680
16.7.4 Method binarySearch 682
16.7.5 Methods addAll, frequency and disjoint 683
16.8 Class PriorityQueue and Interface Queue 685
16.9 Sets 686
16.10 Maps 689
16.11 Synchronized Collections 693
16.12 Unmodifiable Collections 693
16.13 Abstract Implementations 694
16.14 Java SE 9: Convenience Factory Methods for Immutable Collections 694
16.15 Wrap-Up 698

17 Lambdas and Streams 704


17.1 Introduction 705
17.2 Streams and Reduction 707
17.2.1 Summing the Integers from 1 through 10 with a for Loop 707
17.2.2 External Iteration with for Is Error Prone 708
17.2.3 Summing with a Stream and Reduction 708
17.2.4 Internal Iteration 709
17.3 Mapping and Lambdas 710
17.3.1 Lambda Expressions 711
17.3.2 Lambda Syntax 712
17.3.3 Intermediate and Terminal Operations 713
17.4 Filtering 714
17.5 How Elements Move Through Stream Pipelines 716
17.6 Method References 717
17.6.1 Creating an IntStream of Random Values 718
17.6.2 Performing a Task on Each Stream Element with forEach and
a Method Reference 718
17.6.3 Mapping Integers to String Objects with mapToObj 719
17.6.4 Concatenating Strings with collect 719
17.7 IntStream Operations 720
17.7.1 Creating an IntStream and Displaying Its Values 721
17.7.2 Terminal Operations count, min, max, sum and average 721
17.7.3 Terminal Operation reduce 722
17.7.4 Sorting IntStream Values 724
Contents 17

17.8 Functional Interfaces 725


17.9 Lambdas: A Deeper Look 726
17.10 Stream<Integer> Manipulations 727
17.10.1 Creating a Stream<Integer> 728
17.10.2 Sorting a Stream and Collecting the Results 729
17.10.3 Filtering a Stream and Storing the Results for Later Use 729
17.10.4 Filtering and Sorting a Stream and Collecting the Results 730
17.10.5 Sorting Previously Collected Results 730
17.11 Stream<String> Manipulations 730
17.11.1 Mapping Strings to Uppercase 731
17.11.2 Filtering Strings Then Sorting Them in Case-Insensitive
Ascending Order 732
17.11.3 Filtering Strings Then Sorting Them in Case-Insensitive
Descending Order 732
17.12 Stream<Employee> Manipulations 733
17.12.1 Creating and Displaying a List<Employee> 734
17.12.2 Filtering Employees with Salaries in a Specified Range 735
17.12.3 Sorting Employees By Multiple Fields 738
17.12.4 Mapping Employees to Unique-Last-Name Strings 740
17.12.5 Grouping Employees By Department 741
17.12.6 Counting the Number of Employees in Each Department 742
17.12.7 Summing and Averaging Employee Salaries 743
17.13 Creating a Stream<String> from a File 744
17.14 Streams of Random Values 747
17.15 Infinite Streams 749
17.16 Lambda Event Handlers 751
17.17 Additional Notes on Java SE 8 Interfaces 751
17.18 Wrap-Up 752

18 Recursion 766
18.1 Introduction 767
18.2 Recursion Concepts 768
18.3 Example Using Recursion: Factorials 769
18.4 Reimplementing Class FactorialCalculator Using BigInteger 771
18.5 Example Using Recursion: Fibonacci Series 773
18.6 Recursion and the Method-Call Stack 776
18.7 Recursion vs. Iteration 777
18.8 Towers of Hanoi 779
18.9 Fractals 781
18.9.1 Koch Curve Fractal 782
18.9.2 (Optional) Case Study: Lo Feather Fractal 783
18.9.3 (Optional) Fractal App GUI 785
18.9.4 (Optional) FractalController Class 787
18.10 Recursive Backtracking 792
18.11 Wrap-Up 792
18 Contents

19 Searching, Sorting and Big O 801


19.1 Introduction 802
19.2 Linear Search 803
19.3 Big O Notation 806
19.3.1 O(1) Algorithms 806
19.3.2 O(n) Algorithms 806
19.3.3 O(n2) Algorithms 806
19.3.4 Big O of the Linear Search 807
19.4 Binary Search 807
19.4.1 Binary Search Implementation 808
19.4.2 Efficiency of the Binary Search 811
19.5 Sorting Algorithms 812
19.6 Selection Sort 812
19.6.1 Selection Sort Implementation 813
19.6.2 Efficiency of the Selection Sort 815
19.7 Insertion Sort 815
19.7.1 Insertion Sort Implementation 816
19.7.2 Efficiency of the Insertion Sort 818
19.8 Merge Sort 819
19.8.1 Merge Sort Implementation 819
19.8.2 Efficiency of the Merge Sort 824
19.9 Big O Summary for This Chapter’s Searching and Sorting Algorithms 824
19.10 Massive Parallelism and Parallel Algorithms 825
19.11 Wrap-Up 825

20 Generic Classes and Methods: A Deeper Look 831


20.1 Introduction 832
20.2 Motivation for Generic Methods 832
20.3 Generic Methods: Implementation and Compile-Time Translation 834
20.4 Additional Compile-Time Translation Issues: Methods That Use a Type
Parameter as the Return Type 837
20.5 Overloading Generic Methods 840
20.6 Generic Classes 841
20.7 Wildcards in Methods That Accept Type Parameters 848
20.8 Wrap-Up 852

21 Custom Generic Data Structures 856


21.1 Introduction 857
21.2 Self-Referential Classes 858
21.3 Dynamic Memory Allocation 858
21.4 Linked Lists 859
21.4.1 Singly Linked Lists 859
21.4.2 Implementing a Generic List Class 860
21.4.3 Generic Classes ListNode and List 863
Contents 19

21.4.4 Class ListTest 863


21.4.5 List Method insertAtFront 865
21.4.6 List Method insertAtBack 866
21.4.7 List Method removeFromFront 866
21.4.8 List Method removeFromBack 867
21.4.9 List Method print 868
21.4.10 Creating Your Own Packages 868
21.5 Stacks 873
21.6 Queues 876
21.7 Trees 878
21.8 Wrap-Up 885

22 JavaFX Graphics and Multimedia 910


22.1 Introduction 911
22.2 Controlling Fonts with Cascading Style Sheets (CSS) 912
22.2.1 CSS That Styles the GUI 912
22.2.2 FXML That Defines the GUI—Introduction to XML Markup 915
22.2.3 Referencing the CSS File from FXML 918
22.2.4 Specifying the VBox’s Style Class 918
22.2.5 Programmatically Loading CSS 918
22.3 Displaying Two-Dimensional Shapes 919
22.3.1 Defining Two-Dimensional Shapes with FXML 919
22.3.2 CSS That Styles the Two-Dimensional Shapes 922
22.4 Polylines, Polygons and Paths 924
22.4.1 GUI and CSS 925
22.4.2 PolyShapesController Class 926
22.5 Transforms 929
22.6 Playing Video with Media, MediaPlayer and MediaViewer 931
22.6.1 VideoPlayer GUI 932
22.6.2 VideoPlayerController Class 934
22.7 Transition Animations 938
22.7.1 TransitionAnimations.fxml 938
22.7.2 TransitionAnimationsController Class 940
22.8 Timeline Animations 944
22.9 Frame-by-Frame Animation with AnimationTimer 947
22.10 Drawing on a Canvas 949
22.11 Three-Dimensional Shapes 954
22.12 Wrap-Up 957

23 Concurrency 973
23.1 Introduction 974
23.2 Thread States and Life Cycle 976
23.2.1 New and Runnable States 977
23.2.2 Waiting State 977
Discovering Diverse Content Through
Random Scribd Documents
Behold, this day they are an uninhabited waste,
Because of their wickedness which they wrought to
provoke Me to anger,
By going to burn incense and to serve other gods
whom neither they nor their fathers knew."
The Israelites had enjoyed for centuries intimate personal relations
with Jehovah, and knew Him by this ancient and close fellowship
and by all His dealings with them. They had no such knowledge of
the gods of surrounding nations. They were like foolish children who
prefer the enticing blandishments of a stranger to the affection and
discipline of their home. Such children do not intend to forsake their
home or to break the bonds of filial affection, and yet the new
friendship may wean their hearts from their father. So these exiles
still considered themselves worshippers of Jehovah, and yet their
superstition led them to disobey and dishonour Him.
Before its ruin, Judah had sinned against light and leading:—

"Howbeit I sent unto you all My servants the prophets,


Rising up early and sending them, saying,
Oh do not this abominable thing that I hate.
But they hearkened not, nor inclined their ears, so as
to turn from their evil,
That they should not burn incense to other gods.
Wherefore My fury and My anger was poured forth."

Political and social questions, the controversies with the prophets


who contradicted Jeremiah in the name of Jehovah, have fallen into
the background; the poor pretence of loyalty to Jehovah which
permitted His worshippers to degrade Him to the level of Baal and
Moloch is ignored as worthless: and Jeremiah, like Ezekiel, finds the
root of the people's sin in their desertion of Jehovah. Their real
religion was revealed by their heathenish superstitions. Every
religious life is woven of many diverse strands; if the web as a whole
is rotten, the Great Taskmaster can take no account of a few threads
that have a form and profession of soundness. Our Lord declared
that He would utterly ignore and repudiate men upon whose lips His
name was a too familiar word, who had preached and cast out devils
and done many mighty works in that Holy Name. These were men
who had worked iniquity, who had combined promising externals
with the worship of "other gods," Mammon or Belial or some other
of those evil powers, who place

"Within His sanctuary itself their shrines,


Abominations; and with cursed things
His holy rites and solemn feasts profane;
And with their darkness dare affront His light."

This profane blending of idolatry with a profession of zeal for


Jehovah had provoked the divine wrath against Judah: and yet the
exiles had not profited by their terrible experience of the
consequences of sin; they still burnt incense unto other gods.
Therefore Jeremiah remonstrates with them afresh, and sets before
their eyes the utter ruin which will punish persistent sin. This
discourse repeats and enlarges the threats uttered at Bethlehem.
The penalties then denounced on disobedience are now attributed to
idolatry. We have here yet another example of the tacit
understanding attaching to all the prophet's predictions. The most
positive declarations of doom are often warnings and not final
sentences. Jehovah does not turn a deaf ear to the penitent, and the
doom is executed not because He exacts the uttermost farthing, but
because the culprit perseveres in his uttermost wrong. Lack of faith
and loyalty at Bethlehem and idolatry in Egypt were both symptoms
of the same deep-rooted disease.
On this occasion there was no rival prophet to beard Jeremiah and
relieve his hearers from their fears and scruples. Probably indeed no
professed prophet of Jehovah would have cared to defend the
worship of other gods. But, as at Bethlehem, the people themselves
ventured to defy their aged mentor. They seem to have been
provoked to such hardihood by a stimulus which often prompts
timorous men to bold words. Their wives were specially devoted to
the superstitious burning of incense, and these women were present
in large numbers. Probably, like Lady Macbeth, they had already in
private

"Poured their spirits in their husbands' ears,


And chastised, with the valour of their tongues,
All that impeded"

those husbands from speaking their minds to Jeremiah. In their


presence, the men dared not shirk an obvious duty, for fear of more
domestic chastisement. The prophet's reproaches would be less
intolerable than such inflictions. Moreover the fair devotees did not
hesitate to mingle their own shrill voices in the wordy strife.
These idolatrous Jews—male and female—carried things with a very
high hand indeed:—
"We will not obey thee in that which thou hast spoken unto us in the
name of Jehovah. We are determined to perform all the vows we
have made to burn incense and other libations to the Queen of
Heaven, exactly as we have said and as we and our fathers and
kings and princes did in the cities of Judah and in the streets of
Jerusalem."[173]
Moreover they were quite prepared to meet Jeremiah on his own
ground and argue with him according to his own principles and
methods. He had appealed to the ruin of Judah as a proof of
Jehovah's condemnation of their idolatry and of His power to punish:
they argued that these misfortunes were a divine spretæ injuria
formæ, the vengeance of the Queen of Heaven, whose worship they
had neglected. When they duly honoured her,—
"Then had we plenty of victuals, and were prosperous and saw no
evil; but since we left off burning incense and offering libations to
the Queen of Heaven, we have been in want of everything, and have
been consumed by the sword and the famine."
Moreover the women had a special plea of their own:—
"When we burned incense and offered libations to the Queen of
Heaven, did we not make cakes to symbolise her and offer libations
to her with our husbands' permission?"
A wife's vows were not valid without her husband's sanction, and the
women avail themselves of this principle to shift the responsibility for
their superstition on the men's shoulders. Possibly too the
unfortunate Benedicts were not displaying sufficient zeal in the good
cause, and these words were intended to goad them into greater
energy. Doubtless they cannot be entirely exonerated of blame for
tolerating their wives' sins, probably they were guilty of participation
as well as connivance. Nothing however but the utmost
determination and moral courage would have curbed the exuberant
religiosity of these devout ladies. The prompt suggestion that, if they
have done wrong, their husbands are to blame for letting them have
their own way, is an instance of the meanness which results from
the worship of "other gods."
But these defiant speeches raise a more important question. There is
an essential difference between regarding a national catastrophe as
a divine judgment and the crude superstition to which an eclipse
expresses the resentment of an angry god. But both involve the
same practical uncertainty. The sufferers or the spectators ask what
god wrought these marvels and what sins they are intended to
punish, and to these questions neither catastrophe nor eclipse gives
any certain answer.
Doubtless the altars of the Queen of Heaven had been destroyed by
Josiah in his crusade against heathen cults; but her outraged
majesty had been speedily avenged by the defeat and death of the
iconoclast, and since then the history of Judah had been one long
series of disasters. Jeremiah declared that these were the just
retribution inflicted by Jehovah because Judah had been disloyal to
Him; in the reign of Manasseh their sin had reached its climax:—
"I will cause them to be tossed to and fro among all the nations of
the earth, because of Manasseh ben Hezekiah, king of Judah, for
that which he did in Jerusalem."[174]
His audience were equally positive that the national ruin was the
vengeance of the Queen of Heaven. Josiah had destroyed her altars,
and now the worshippers of Istar had retaliated by razing the
Temple to the ground. A Jew, with the vague impression that Istar
was as real as Jehovah, might find it difficult to decide between
these conflicting theories.
To us, as to Jeremiah, it seems sheer nonsense to speak of the
vengeance of the Queen of Heaven, not because of what we deduce
from the circumstances of the fall of Jerusalem, but because we do
not believe in any such deity. But the fallacy is repeated when, in
somewhat similar fashion, Protestants find proof of the superiority of
their faith in the contrast between England and Catholic Spain, while
Romanists draw the opposite conclusion from a comparison of
Holland and Belgium. In all such cases the assured truth of the
disputant's doctrine, which is set forth as the result of his argument,
is in reality the premise upon which his reasoning rests. Faith is not
deduced from, but dictates an interpretation of history. In an
individual the material penalties of sin may arouse a sleeping
conscience, but they cannot create a moral sense: apart from a
moral sense the discipline of rewards and punishments would be
futile:—

"Were no inner eye in us to tell,


Instructed by no inner sense,
The light of heaven from the dark of hell,
That light would want its evidence."

Jeremiah, therefore, is quite consistent in refraining from argument


and replying to his opponents by reiterating his former statements
that sin against Jehovah had ruined Judah and would yet ruin the
exiles. He spoke on the authority of the "inner sense," itself
instructed by Revelation. But, after the manner of the prophets, he
gave them a sign—Pharaoh Hophra should be delivered into the
hand of his enemies as Zedekiah had been. Such an event would
indeed be an unmistakable sign of imminent calamity to the fugitives
who had sought the protection of the Egyptian king against
Nebuchadnezzar.[175]
We have reserved for separate treatment the questions suggested
by the references to the Queen of Heaven.[176] This divine name
only occurs again in the Old Testament in vii. 18, and we are
startled, at first sight, to discover that a cult about which all other
historians and prophets have been entirely silent is described in
these passages as an ancient and national worship. It is even
possible that the "great assembly" was a festival in her honour. We
have again to remind ourselves that the Old Testament is an account
of the progress of Revelation and not a History of Israel. Probably
the true explanation is that given by Kuenen. The prophets do not,
as a rule, speak of the details of false worship; they use the generic
"Baal" and the collective "other gods." Even in this chapter Jeremiah
begins by speaking of "other gods," and only uses the term "Queen
of Heaven" when he quotes the reply made to him by the Jews.
Similarly when Ezekiel goes into detail concerning idolatry[177] he
mentions cults and ritual[178] which do not occur elsewhere in the
Old Testament. The prophets were little inclined to discriminate
between different forms of idolatry, just as the average churchman is
quite indifferent to the distinctions of the various Nonconformist
bodies, which are to him simply "dissenters." One might read many
volumes of Anglican sermons and even some English Church History
without meeting with the term Unitarian.
It is easy to find modern parallels—Christian and heathen—to the
name of this goddess. The Virgin Mary is honoured with the title
Regina Cœli, and at Mukden, the Sacred City of China, there is a
temple to the Queen of Heaven. But it is not easy to identify the
ancient deity who bore this name. The Jews are accused elsewhere
of worshipping "the sun and the moon and all the host of heaven,"
and one or other of these heavenly bodies—mostly either the moon
or the planet Venus—has been supposed to have been the Queen of
Heaven.
Neither do the symbolic cakes help us. Such emblems are found in
the ritual of many ancient cults: at Athens cakes called σελῆναι, and
shaped like a full-moon were offered to the moon-goddess Artemis;
a similar usage seems to have prevailed in the worship of the
Arabian goddess Al-Uzza, whose star was Venus, and also of
connection with the worship of the sun.[179]
Moreover we do not find the title "Queen of Heaven" as an ordinary
and well-established name of any neighbouring divinity. "Queen" is a
natural title for any goddess, and was actually given to many ancient
deities. Schrader[180] finds our goddess in the Atar-samain (Athar-
Astarte) who is mentioned in the Assyrian ascriptions as worshipped
by a North Arabian tribe of Kedarenes. Possibly too the Assyrian
Istar is called Queen of Heaven.[181]
Istar, however, is connected with the moon as well as with the planet
Venus.[182] For the present therefore we must be content to leave
the matter an open question,[183] but any day some new discovery
may solve the problem. Meanwhile it is interesting to notice how
little religious ideas and practices are affected by differences in
profession. St. Isaac the Great, of Antioch, who died about a.d. 460,
tells us that the Christian ladies of Syria—whom he speaks of very
ungallantly as "fools"—used to worship the planet Venus from the
roofs of their houses, in the hope that she would bestow upon them
some portion of her own brightness and beauty. His experience
naturally led St. Isaac to interpret the Queen of Heaven as the
luminary which his countrywomen venerated.[184]
The episode of the "great assembly" closes the history of Jeremiah's
life. We leave him (as we so often met with him before) hurling
ineffective denunciations at a recalcitrant audience. Vagrant fancy,
holding this to be a lame and impotent conclusion, has woven
romantic stories to continue and complete the narrative. There are
traditions that he was stoned to death at Tahpanhes, and that his
bones were removed to Alexandria by Alexander the Great; that he
and Baruch returned to Judea or went to Babylon and died in peace;
that he returned to Jerusalem and lived there three hundred years,—
and other such legends. As has been said concerning the Apocryphal
Gospels, these narratives serve as a foil to the history they are
meant to supplement: they remind us of the sequels of great novels
written by inferior pens, or of attempts made by clumsy mechanics
to convert a bust by some inspired sculptor into a full-length statue.
For this story of Jeremiah's life is not a torso. Sacred biography
constantly disappoints our curiosity as to the last days of holy men.
We are scarcely ever told how prophets and apostles died. It is
curious too that the great exceptions—Elijah in his chariot of fire and
Elisha dying quietly in his bed—occur before the period of written
prophecy. The deaths of Isaiah, Jeremiah, and Ezekiel, Peter, Paul,
and John, are passed over in the Sacred Record, and when we seek
to follow them beyond its pages, we are taught afresh the unique
wisdom of inspiration. If we may understand Deuteronomy xxxiv. to
imply that no eye was permitted to behold Moses in the hour of
death, we have in this incident a type of the reticence of Scripture
on such matters. Moreover a moment's reflection reminds us that
the inspired method is in accordance with the better instincts of our
nature. A death in opening manhood, or the death of a soldier in
battle or of a martyr at the stake, rivets our attention; but when
men die in a good old age, we dwell less on their declining years
than on the achievements of their prime. We all remember the
martyrdoms of Huss and Latimer, but how many of those in whose
mouths Calvin and Luther are familiar as household words know how
those great Reformers died?
There comes a time when we may apply to the aged saint the words
of Browning's Death in the Desert:—

"So is myself withdrawn into my depths,


The soul retreated from the perished brain
Whence it was wont to feel and use the world
Through these dull members, done with long ago."
And the poet's comparison of this soul to

"A stick once fire from end to end;


Now, ashes save the tip that holds a spark."

Love craves to watch to the last, because the spark may

"Run back, spread itself


A little where the fire was....
And we would not lose
The last of what might happen on his face."

Such privileges may be granted to a few chosen disciples, probably


they were in this case granted to Baruch; but they are mostly
withheld from the world, lest blind irreverence should see in the
aged saint nothing but

"Second childishness, and mere oblivion;


Sans teeth, sans eyes, sans taste, sans everything."
BOOK II
PROPHECIES CONCERNING FOREIGN
NATIONS
CHAPTER XVI
JEHOVAH AND THE NATIONS
xxv. 15-38.

"Jehovah hath a controversy with the nations."—Jer. xxv. 31.

As the son of a king only learns very gradually that his father's
authority and activity extend beyond the family and the household,
so Israel in its childhood thought of Jehovah as exclusively
concerned with itself.
Such ideas as omnipotence and universal Providence did not exist;
therefore they could not be denied; and the limitations of the
national faith were not essentially inconsistent with later Revelation.
But when we reach the period of recorded prophecy we find that,
under the guidance of the Holy Spirit, the prophets had begun to
recognise Jehovah's dominion over surrounding peoples. There was,
as yet, no deliberate and formal doctrine of omnipotence, but, as
Israel became involved in the fortunes first of one foreign power and
then of another, the prophets asserted that the doings of these
heathen states were overruled by the God of Israel. The idea of
Jehovah's Lordship of the Nations enlarged with the extension of
international relations, as our conception of the God of Nature has
expanded with the successive discoveries of science. Hence, for the
most part, the prophets devote special attention to the concerns of
Gentile peoples. Hosea, Micah, Haggai, Zechariah, and Malachi are
partial exceptions. Some of the minor prophets have for their main
subject the doom of a heathen empire. Jonah and Nahum deal with
Nineveh, Habbakuk with Chaldea, and Edom is specially honoured by
being almost the sole object of the denunciations of Obadiah. Daniel
also deals with the fate of the kingdoms of the world, but in the
Apocalyptic fashion of the Pseudepigrapha. Jewish criticism rightly
declined to recognise this book as prophetic, and relegated it to the
latest collection of canonical scriptures.
Each of the other prophetical books contains a longer or shorter
series of utterances concerning the neighbours of Israel, its friends
and foes, its enemies and allies. The fashion was apparently set by
Amos, who shows God's judgment upon Damascus, the Philistines,
Tyre, Edom, Ammon, and Moab. This list suggests the range of the
prophet's religious interest in the Gentiles. Assyria and Egypt were,
for the present, beyond the sphere of Revelation, just as China and
India were to the average Protestant of the seventeenth century.
When we come to the Book of Isaiah, the horizon widens in every
direction. Jehovah is concerned with Egypt and Ethiopia, Assyria and
Babylon.[185] In very short books like Joel and Zephaniah we could
not expect exhaustive treatment of this subject. Yet even these
prophets deal with the fortunes of the Gentiles: Joel, variously held
one of the latest or one of the earliest of the canonical books,
pronounces a divine judgment on Tyre and Sidon and the Philistines,
on Egypt and Edom; and Zephaniah, an elder contemporary of
Jeremiah, devotes sections to the Philistines, Moab and Ammon,
Ethiopia and Assyria.
The fall of Nineveh revolutionised the international system of the
East. The judgment on Asshur was accomplished, and her name
disappears from these catalogues of doom. In other particulars
Jeremiah, as well as Ezekiel, follows closely in the footsteps of his
predecessors. He deals, like them, with the group of Syrian and
Palestinian states—Philistines, Moab, Ammon, Edom, and Damascus.
[186] He dwells with repeated emphasis on Egypt, and Arabia is
represented by Kedar and Hazor. In one section the prophet travels
into what must have seemed to his contemporaries the very far East,
as far as Elam. On the other hand, he is comparatively silent about
Tyre, in which Joel, Amos, the Book of Isaiah,[187] and above all
Ezekiel display a lively interest. Nebuchadnezzar's campaigns were
directed against Tyre as much as against Jerusalem; and Ezekiel,
living in Chaldea, would have attention forcibly directed to the
Phœnician capital, at a time when Jeremiah was absorbed in the
fortunes of Zion.
But in the passage which we have chosen as the subject for this
introduction to the prophecies of the nations, Jeremiah takes a
somewhat wider range:—

"Thus saith unto me Jehovah, the God of Israel:


Take at My hand this cup of the wine of fury,
And make all the nations, to whom I send thee, drink
it.
They shall drink, and reel to and fro, and be mad,
Because of the sword that I will send among them."

First and foremost of these nations, pre-eminent in punishment as in


privilege, stand "Jerusalem and the cities of Judah, with its kings
and princes."
This bad eminence is a necessary application of the principle laid
down by Amos[188]:—

"You only have I known of all the families of the earth:


Therefore I will visit upon you all your iniquities."

But as Jeremiah says later on, addressing the Gentile nations,—

"I begin to work evil at the city which is called by My


name.
Should ye go scot-free? Ye shall not go scot-free."

And the prophet puts the cup of God's fury to their lips also, and
amongst them, Egypt, the bête noir of Hebrew seers, is most
conspicuously marked out for destruction: "Pharaoh king of Egypt,
and his servants and princes and all his people, and all the mixed
population of Egypt."[189] Then follows, in epic fashion, a catalogue
of "all the nations" as Jeremiah knew them: "All the kings of the land
of Uz, all the kings of the land of the Philistines; Ashkelon, Gaza,
Ekron, and the remnant of Ashdod;[190] Edom, Moab, and the
Ammonites; all the kings[191] of Tyre, all the kings of Zidon, and the
kings of their colonies[192] beyond the sea; Dedan and Tema and
Buz, and all that have the corners of their hair polled;[193] and all
the kings of Arabia, and all the kings of the mixed populations that
dwell in the desert; all the kings of Zimri, all the kings of Elam, and
all the kings of the Medes." Jeremiah's definite geographical
information is apparently exhausted, but he adds by way of
summary and conclusion: "And all the kings of the north, far and
near, one after the other; and all the kingdoms of the world, which
are on the face of the earth."
There is one notable omission in the list. Nebuchadnezzar, the
servant of Jehovah,[194] was the divinely appointed scourge of Judah
and its neighbours and allies. Elsewhere[195] the nations are
exhorted to submit to him, and here apparently Chaldea is exempted
from the general doom, just as Ezekiel passes no formal sentence on
Babylon. It is true that "all the kingdoms of the earth" would
naturally include Babylon, possibly were even intended to do so. But
the Jews were not long content with so veiled a reference to their
conquerors and oppressors. Some patriotic scribe added the
explanatory note, "And the king of Sheshach (i.e. Babylon) shall
drink after them."[196] Sheshach is obtained from Babel by the
cypher 'Athbash, according to which an alphabet is written out and a
reversed alphabet written out underneath it, and the letters of the
lower row used for those of the upper and vice versâ. Thus
Aleph B K L
T SH L K
The use of cypher seems to indicate that the note was added in
Chaldea during the Exile, when it was not safe to circulate
documents which openly denounced Babylon. Jeremiah's
enumeration of the peoples and rulers of his world is naturally more
detailed and more exhaustive than the list of the nations against
which he prophesied. It includes the Phœnician states, details the
Philistine cities, associates with Elam the neighbouring nations of
Zimri and the Medes, and substitutes for Kedar and Hazor Arabia
and a number of semi-Arab states, Uz, Dedan, Tema, and Buz.[197]
Thus Jeremiah's world is the district constantly shown in Scripture
atlases in a map comprising the scenes of Old Testament history,
Egypt, Arabia, and Western Asia, south of a line from the north-east
corner of the Mediterranean to the southern end of the Caspian Sea,
and west of a line from the latter point to the northern end of the
Persian Gulf. How much of history has been crowded into this
narrow area! Here science, art, and literature won those primitive
triumphs which no subsequent achievements could surpass or even
equal. Here, perhaps for the first time, men tasted the Dead Sea
apples of civilisation, and learnt how little accumulated wealth and
national splendour can do for the welfare of the masses. Here was
Eden, where God walked in the cool of the day to commune with
man; and here also were many Mount Moriahs, where man gave his
firstborn for his transgression, the fruit of his body for the sin of his
soul, and no angel voice stayed his hand.
And now glance at any modern map and see for how little
Jeremiah's world counts among the great Powers of the nineteenth
century. Egypt indeed is a bone of contention between European
states, but how often does a daily paper remind its readers of the
existence of Syria or Mesopotamia? We may apply to this ancient
world the title that Byron gave to Rome, "Lone mother of dead
empires," and call it:—

"The desert, where we steer


Stumbling o'er recollections."

It is said that Scipio's exultation over the fall of Carthage was marred
by forebodings that Time had a like destiny in store for Rome.
Where Cromwell might have quoted a text from the Bible, the
Roman soldier applied to his native city the Homeric lines:—

"Troy shall sink in fire,


And Priam's city with himself expire."

The epitaphs of ancient civilisations are no mere matters of


archæology; like the inscriptions on common graves, they carry a
Memento mori for their successors.
But to return from epitaphs to prophecy: in the list which we have
just given, the kings of many of the nations are required to drink the
cup of wrath, and the section concludes with a universal judgment
upon the princes and rulers of this ancient world under the familiar
figure of shepherds, supplemented here by another, that of the
"principal of the flock," or, as we should say, "bell-wethers." Jehovah
would break out upon them to rend and scatter like a lion from his
covert. Therefore:—

"Howl, ye shepherds, and cry!


Roll yourselves in the dust, ye bell-wethers!
The time has fully come for you to be slaughtered.
I will cast you down with a crash, like a vase of
porcelain.[198]
Ruin hath overtaken the refuge of the shepherds,
And the way of escape of the bell-wethers."

Thus Jeremiah announces the coming ruin of an ancient world, with


all its states and sovereigns, and we have seen that the prediction
has been amply fulfilled. We can only notice two other points with
regard to this section.
First, then, we have no right to accuse the prophet of speaking from
a narrow national standpoint. His words are not the expression of
the Jewish adversus omnes alios hostile odium;[199] if they were, we
should not hear so much of Judah's sin and Judah's punishment. He
applied to heathen states as he did to his own the divine standard of
national righteousness, and they too were found wanting. All history
confirms Jeremiah's judgment. This brings us to our second point.
Christian thinkers have been engrossed in the evidential aspect of
these national catastrophes. They served to fulfil prophecy, and
therefore the squalor of Egypt and the ruins of Assyria to-day have
seemed to make our way of salvation more safe and certain. But
God did not merely sacrifice these holocausts of men and nations to
the perennial craving of feeble faith for signs. Their fate must of
necessity illustrate His justice and wisdom and love. Jeremiah tells
us plainly that Judah and its neighbours had filled up the measure of
their iniquity before they were called upon to drink the cup of wrath;
national sin justifies God's judgments. Yet these very facts of the
moral failure and decadence of human societies perplex and startle
us. Individuals grow old and feeble and die, but saints and heroes
do not become slaves of vice and sin in their last days. The glory of
their prime is not buried in a dishonoured grave. Nay rather, when all
else fails, the beauty of holiness grows more pure and radiant. But
of what nation could we say:—

"Let me die the death of the righteous,


Let my last end be like his"?

Apparently the collective conscience is a plant of very slow growth;


and hitherto no society has been worthy to endure honourably or
even to perish nobly. In Christendom itself the ideals of common
action are still avowedly meaner than those of individual conduct.
International and collective morality is still in its infancy, and as a
matter of habit and system modern states are often wantonly cruel
and unjust towards obscure individuals and helpless minorities. Yet
surely it shall not always be so; the daily prayer of countless millions
for the coming of the Kingdom of God cannot remain unanswered.
CHAPTER XVII
EGYPT
xliii. 8-13, xliv. 30, xlvi.

"I will visit Amon of No, and Pharaoh, and Egypt, with their
gods and their kings; even Pharaoh, and all them that trust in
him."—Jer. xlvi. 25.

The kings of Egypt with whom Jeremiah was contemporary—


Psammetichus II., Pharaoh Necho, and Pharaoh Hophra—belonged
to the twenty-sixth dynasty. When growing distress at home
compelled Assyria to loose her hold on her distant dependencies,
Egypt still retained something of her former vigorous elasticity. In
the rebound from subjection under the heavy hand of Sennacherib,
she resumed her ancient forms of life and government. She regained
her unity and independence, and posed afresh as an equal rival with
Chaldea for the supremacy of Western Asia. At home there was a
renascence of art and literature, and, as of old, the wealth and
devotion of powerful monarchs restored the ancient temples and
erected new shrines of their own.
But this revival was no new growth springing up with a fresh and
original life from the seeds of the past; it cannot rank with the
European Renascence of the fifteenth century. It is rather to be
compared with the reorganisations by which Diocletian and
Constantine prolonged the decline of the Roman Empire, the rally of
a strong constitution in the grip of mortal disease. These latter-day
Pharaohs failed ignominiously in their attempts to recover the Syrian
dominion of the Thothmes and Rameses; and, like the Roman
Empire in its last centuries, the Egypt of the twenty-sixth dynasty
surrendered itself to Greek influence and hired foreign mercenaries
to fight its battles. The new art and literature were tainted by
pedantic archaism. According to Brugsch,[200] "Even to the newly
created dignities and titles, the return to ancient times had become
the general watchword.... The stone door-posts of this age reveal
the old Memphian style of art, mirrored in its modern reflection after
the lapse of four thousand years." Similarly Meyer[201] tells us that
apparently the Egyptian state was reconstituted on the basis of a
religious revival, somewhat in the fashion of the establishment of
Deuteronomy by Josiah.
Inscriptions after the time of Psammetichus are written in archaic
Egyptian of a very ancient past; it is often difficult to determine at
first sight whether inscriptions belong to the earliest or latest period
of Egyptian history.
The superstition that sought safety in an exact reproduction of a
remote antiquity could not, however, resist the fascination of Eastern
demonology. According to Brugsch,[202] in the age called the
Egyptian Renascence the old Egyptian theology was adulterated with
Græco-Asiatic elements—demons and genii of whom the older faith
and its purer doctrine had scarcely an idea; exorcisms became a
special science, and are favourite themes for the inscriptions of this
period. Thus, amid many differences, there are also to be found
striking resemblances between the religious movements of the
period in Egypt and amongst the Jews, and corresponding difficulties
in determining the dates of Egyptian inscriptions and of sections of
the Old Testament.
This enthusiasm for ancient custom and tradition was not likely to
commend the Egypt of Jeremiah's age to any student of Hebrew
history. He would be reminded that the dealings of the Pharaohs
with Israel had almost always been to its hurt; he would remember
the Oppression and the Exodus—how, in the time of Solomon,
friendly intercourse with Egypt taught that monarch lessons in
magnificent tyranny, how Shishak plundered the Temple, how Isaiah
had denounced the Egyptian alliance as a continual snare to Judah.
A Jewish prophet would be prompt to discern the omens of coming
ruin in the midst of renewed prosperity on the Nile.
Accordingly at the first great crisis of the new international system,
in the fourth year of Jehoiakim, either just before or just after the
battle of Carchemish—it matters little which—Jeremiah takes up his
prophecy against Egypt. First of all, with an ostensible friendliness
which only masks his bitter sarcasm, he invites the Egyptians to take
the field:—

"Prepare buckler and shield, and draw near to battle.


Harness the horses to the chariots, mount the
chargers, stand forth armed cap-à-pie for
battle;
Furbish the spears, put on the coats of mail."

This great host with its splendid equipment must surely conquer. The
prophet professes to await its triumphant return; but he sees instead
a breathless mob of panic-stricken fugitives, and pours upon them
the torrent of his irony:—
"How is it that I behold this? These heroes are
dismayed and have turned their backs;
Their warriors have been beaten down;
They flee apace, and do not look behind them:
Terror on every side—is the utterance of Jehovah."

Then irony passes into explicit malediction:—

"Let not the swift flee away, nor the warrior escape;
Away northward, they stumble and fall by the river
Euphrates."

Then, in a new strophe, Jeremiah again recurs in imagination to the


proud march of the countless hosts of Egypt:—

"Who is this that riseth up like the Nile,


Whose waters toss themselves like the rivers?
Egypt riseth up like the Nile,
His waters toss themselves like the rivers.
And he saith, I will go up and cover the land"

(like the Nile in flood);

"I will destroy the cities and their inhabitants"

(and, above all other cities, Babylon).


Again the prophet urges them on with ironical encouragement:—

"Go up, ye horses; rage, ye chariots;


Ethiopians and Libyans that handle the shield,
Lydians that handle and bend the bow"

(the tributaries and mercenaries of Egypt).


Then, as before, he speaks plainly of coming disaster:
"That day is a day of vengeance for the Lord Jehovah
Sabaoth, whereon He will avenge Him of His
adversaries"

(a day of vengeance upon Pharaoh Necho for Megiddo and Josiah).

"The sword shall devour and be sated, and drink its fill
of their blood:
For the Lord Jehovah Sabaoth hath a sacrifice in the
northern land, by the river Euphrates."

In a final strophe, the prophet turns to the land left bereaved and
defenceless by the defeat at Carchemish:—

"Go up to Gilead and get thee balm, O virgin daughter


of Egypt:
In vain dost thou multiply medicines; thou canst not
be healed.
The nations have heard of thy shame, the earth is full
of thy cry:
For warrior stumbles against warrior; they fall both
together."

Nevertheless the end was not yet. Egypt was wounded to death, but
she was to linger on for many a long year to be a snare to Judah
and to vex the righteous soul of Jeremiah. The reed was broken, but
it still retained an appearance of soundness, which more than once
tempted the Jewish princes to lean upon it and find their hands
pierced for their pains. Hence, as we have seen already, Jeremiah
repeatedly found occasion to reiterate the doom of Egypt, of Necho's
successor, Pharaoh Hophra, and of the Jewish refugees who had
sought safety under his protection. In the concluding part of chapter
xlvi., a prophecy of uncertain date sets forth the ruin of Egypt with
rather more literary finish than in the parallel passages.
This word of Jehovah was to be proclaimed in Egypt, and especially
in the frontier cities, which would have to bear the first brunt of
invasion:—

"Declare in Egypt, proclaim in Migdol, proclaim in Noph


and Tahpanhes:
Say ye, Take thy stand and be ready, for the sword
hath devoured round about thee.
Why hath Apis[203] fled and thy calf not stood?
Because Jehovah overthrew it."

Memphis was devoted to the worship of Apis, incarnate in the sacred


bull; but now Apis must succumb to the mightier divinity of Jehovah,
and his sacred city become a prey to the invaders.

"He maketh many to stumble; they fall one against


another.
Then they say, Arise, and let us return to our own
people and to our native land, before the
oppressing sword."

We must remember that the Egyptian armies were largely composed


of foreign mercenaries. In the hour of disaster and defeat these
hirelings would desert their employers and go home.

"Give unto Pharaoh king of Egypt the name[204] Crash;


he hath let the appointed time pass by."

The form of this enigmatic sentence is probably due to a play upon


Egyptian names and titles. When the allusions are forgotten, such
paronomasia naturally results in hopeless obscurity. The "appointed
time" has been explained as the period during which Jehovah gave
Pharaoh the opportunity of repentance, or as that within which he
might have submitted to Nebuchadnezzar on favourable terms.

"As I live, is the utterance of the King, whose name is


Jehovah Sabaoth,
One shall come like Tabor among the mountains and
like Carmel by the sea."
It was not necessary to name this terrible invader; it could be no
other than Nebuchadnezzar.

"Get thee gear for captivity, O daughter of Egypt, that


dwellest in thine own land:
For Noph shall become a desolation, and shall be
burnt up and left without inhabitants.
Egypt is a very fair heifer, but destruction is come
upon her from the north."

This tempest shattered the Greek phalanx in which Pharaoh trusted:


"Even her mercenaries in the midst of her are like


calves of the stall;
Even they have turned and fled together, they have
not stood:
For their day of calamity hath come upon them, their
day of reckoning."

We do not look for chronological sequence in such a poem, so that


this picture of the flight and destruction of the mercenaries is not
necessarily later in time than their overthrow and contemplated
desertion in verse 15. The prophet is depicting a scene of bewildered
confusion; the disasters that fell thick upon Egypt crowd into his
vision without order or even coherence. Now he turns again to Egypt
herself:—

"Her voice goeth forth like the (low hissing of) the
serpent;
For they come upon her with a mighty army, and with
axes like woodcutters."
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookluna.com

You might also like