100% found this document useful (1 vote)
1K views

Get (eBook PDF) Java How to Program, Late Objects Global Edition 11th Edition free all chapters

Java

Uploaded by

lisizoeh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views

Get (eBook PDF) Java How to Program, Late Objects Global Edition 11th Edition free all chapters

Java

Uploaded by

lisizoeh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Download the full version of the ebook now at ebooksecure.

com

(eBook PDF) Java How to Program, Late Objects


Global Edition 11th Edition

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

Explore and download more ebook at https://ebooksecure.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

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

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

ebooksecure.com

(eBook PDF) Java How to Program, Early Objects 11th


Edition by Paul J. Deitel

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

ebooksecure.com

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

http://ebooksecure.com/product/ebook-pdf-java-concepts-late-
objects-3rd-edition/

ebooksecure.com

(eBook PDF) Big Java Late Objects 2nd Edition

http://ebooksecure.com/product/ebook-pdf-big-java-late-objects-2nd-
edition/

ebooksecure.com
C++ How to Program: An Objects-Natural Approach, 11e 11th
Edition Paul Deitel - eBook PDF

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

ebooksecure.com

C++ How to Program Early Objects Version 9th Edition


(eBook PDF)

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

ebooksecure.com

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


PDF

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

ebooksecure.com

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

http://ebooksecure.com/product/ebook-pdf-big-c-late-objects-3rd-
edition/

ebooksecure.com

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

http://ebooksecure.com/product/ebook-pdf-brief-c-late-objects-3rd-
edition/

ebooksecure.com
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
Visit https://ebooksecure.com
now to explore a rich
collection of ebook and enjoy
exciting offers!
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
20 Contents

23.2.3 Timed Waiting State 977


23.2.4 Blocked State 977
23.2.5 Terminated State 977
23.2.6 Operating-System View of the Runnable State 978
23.2.7 Thread Priorities and Thread Scheduling 978
23.2.8 Indefinite Postponement and Deadlock 979
23.3 Creating and Executing Threads with the Executor Framework 979
23.4 Thread Synchronization 983
23.4.1 Immutable Data 984
23.4.2 Monitors 984
23.4.3 Unsynchronized Mutable Data Sharing 985
23.4.4 Synchronized Mutable Data Sharing—Making
Operations Atomic 989
23.5 Producer/Consumer Relationship without Synchronization 992
23.6 Producer/Consumer Relationship: ArrayBlockingQueue 1000
23.7 (Advanced) Producer/Consumer Relationship with synchronized,
wait, notify and notifyAll 1003
23.8 (Advanced) Producer/Consumer Relationship: Bounded Buffers 1009
23.9 (Advanced) Producer/Consumer Relationship: The Lock and
Condition Interfaces 1017
23.10 Concurrent Collections 1024
23.11 Multithreading in JavaFX 1026
23.11.1 Performing Computations in a Worker Thread:
Fibonacci Numbers 1027
23.11.2 Processing Intermediate Results: Sieve of Eratosthenes 1032
23.12 sort/parallelSort Timings with the Java SE 8 Date/Time API 1038
23.13 Java SE 8: Sequential vs. Parallel Streams 1041
23.14 (Advanced) Interfaces Callable and Future 1043
23.15 (Advanced) Fork/Join Framework 1048
23.16 Wrap-Up 1048

24 Accessing Databases with JDBC 1060


24.1 Introduction 1061
24.2 Relational Databases 1062
24.3 A books Database 1063
24.4 SQL 1067
24.4.1 Basic SELECT Query 1068
24.4.2 WHERE Clause 1068
24.4.3 ORDER BY Clause 1070
24.4.4 Merging Data from Multiple Tables: INNER JOIN 1072
24.4.5 INSERT Statement 1073
24.4.6 UPDATE Statement 1074
24.4.7 DELETE Statement 1075
24.5 Setting Up a Java DB Database 1076
24.5.1 Creating the Chapter’s Databases on Windows 1077
Contents 21

24.5.2 Creating the Chapter’s Databases on macOS 1078


24.5.3 Creating the Chapter’s Databases on Linux 1078
24.6 Connecting to and Querying a Database 1078
24.6.1 Automatic Driver Discovery 1080
24.6.2 Connecting to the Database 1080
24.6.3 Creating a Statement for Executing Queries 1081
24.6.4 Executing a Query 1081
24.6.5 Processing a Query’s ResultSet 1082
24.7 Querying the books Database 1083
24.7.1 ResultSetTableModel Class 1083
24.7.2 DisplayQueryResults App’s GUI 1090
24.7.3 DisplayQueryResultsController Class 1090
24.8 RowSet Interface 1095
24.9 PreparedStatements 1098
24.9.1 AddressBook App That Uses PreparedStatements 1099
24.9.2 Class Person 1099
24.9.3 Class PersonQueries 1101
24.9.4 AddressBook GUI 1104
24.9.5 Class AddressBookController 1105
24.10 Stored Procedures 1110
24.11 Transaction Processing 1110
24.12 Wrap-Up 1111

25 Introduction to JShell: Java 9’s REPL for


Interactive Java 1119
25.1 Introduction 1120
25.2 Installing JDK 9 1122
25.3 Introduction to JShell 1122
25.3.1 Starting a JShell Session 1123
25.3.2 Executing Statements 1123
25.3.3 Declaring Variables Explicitly 1124
25.3.4 Listing and Executing Prior Snippets 1126
25.3.5 Evaluating Expressions and Declaring Variables Implicitly 1128
25.3.6 Using Implicitly Declared Variables 1128
25.3.7 Viewing a Variable’s Value 1129
25.3.8 Resetting a JShell Session 1129
25.3.9 Writing Multiline Statements 1129
25.3.10 Editing Code Snippets 1130
25.3.11 Exiting JShell 1133
25.4 Command-Line Input in JShell 1133
25.5 Declaring and Using Classes 1134
25.5.1 Creating a Class in JShell 1135
25.5.2 Explicitly Declaring Reference-Type Variables 1135
25.5.3 Creating Objects 1136
25.5.4 Manipulating Objects 1136
22 Contents

25.5.5 Creating a Meaningful Variable Name for an Expression 1137


25.5.6 Saving and Opening Code-Snippet Files 1138
25.6 Discovery with JShell Auto-Completion 1138
25.6.1 Auto-Completing Identifiers 1139
25.6.2 Auto-Completing JShell Commands 1140
25.7 Exploring a Class’s Members and Viewing Documentation 1140
25.7.1 Listing Class Math’s static Members 1141
25.7.2 Viewing a Method’s Parameters 1141
25.7.3 Viewing a Method’s Documentation 1142
25.7.4 Viewing a public Field’s Documentation 1142
25.7.5 Viewing a Class’s Documentation 1143
25.7.6 Viewing Method Overloads 1143
25.7.7 Exploring Members of a Specific Object 1144
25.8 Declaring Methods 1146
25.8.1 Forward Referencing an Undeclared Method—Declaring
Method displayCubes 1146
25.8.2 Declaring a Previously Undeclared Method 1146
25.8.3 Testing cube and Replacing Its Declaration 1147
25.8.4 Testing Updated Method cube and Method displayCubes 1147
25.9 Exceptions 1148
25.10 Importing Classes and Adding Packages to the CLASSPATH 1149
25.11 Using an External Editor 1151
25.12 Summary of JShell Commands 1153
25.12.1 Getting Help in JShell 1154
25.12.2 /edit Command: Additional Features 1155
25.12.3 /reload Command 1155
25.12.4 /drop Command 1156
25.12.5 Feedback Modes 1156
25.12.6 Other JShell Features Configurable with /set 1158
25.13 Keyboard Shortcuts for Snippet Editing 1159
25.14 How JShell Reinterprets Java for Interactive Use 1159
25.15 IDE JShell Support 1160
25.16 Wrap-Up 1160

Chapters on the Web 1176

A Operator Precedence Chart 1177

B ASCII Character Set 1179

C Keywords and Reserved Words 1180

D Primitive Types 1181


Contents 23

E Using the Debugger 1182


E.1 Introduction 1183
E.2 Breakpoints and the run, stop, cont and print Commands 1183
E.3 The print and set Commands 1187
E.4 Controlling Execution Using the step, step up and next Commands 1189
E.5 The watch Command 1191
E.6 The clear Command 1193
E.7 Wrap-Up 1196

Appendices on the Web 1197

Index 1199

Online Chapters and Appendices


The online chapters and appendices are located on the book’s Companion Website. See
the book’s inside front cover for details.

26 Swing GUI Components: Part 1


27 Graphics and Java 2D
28 Networking
29 Java Persistence API (JPA)
30 JavaServer™ Faces Web Apps: Part 1
31 JavaServer™ Faces Web Apps: Part 2
32 REST-Based Web Services
33 (Optional) ATM Case Study, Part 1:
Object-Oriented Design with the UML
34 (Optional) ATM Case Study, Part 2:
Implementing an Object-Oriented Design
35 Swing GUI Components: Part 2
36 Java Module System and Other Java 9 Features
Other documents randomly have
different content
On these hearths reposed cylindrical pots with curious lids, and
above the fire great iron caldrons, capable of providing for many
mouths, were hung from the wooden arms of primitive jacks, such
as I remember having seen in Finnish cottages.
The common hall contained little but a long table and two long
benches, recalling, except for its honeycombed stove, the furniture
of an Oxford College hall. It is here that the whole family take their
meals; and in the winter time, when the stoveless summer dwellings
are uninhabitable, it is here that the men take shelter from the blast
to make or mend their rude implements of husbandry, and the
women ply their homely looms. They told us further that this was
the room in which the family met to choose their house-father or
house-mother, and to transact all common business; and, since
dinner is the natural time for all the family to be assembled together,
it is after dinner that these matters of household economy are
mooted, and the house-father, who represents the family in dealings
with the authorities, and the house-mother, who shares with her
consort[161] his patriarchal sway over the rest of the house-
community, are elected. It is here, too, that the domestic
government is thrown out if it does not continue to give satisfaction
to its constituents. In short, this is their little Parliament-House, and
these the earliest germs of Constitutional Government.
But we must leave Slavonia for the present, and transport
ourselves back in some aërial fashion to Karlovac, from which town
we are about to make our way to Siszek by the last strip of railway
we were to see for many a long day. It may be that it was lucky that
such a means of transit was still at our disposal, since, if we had
been obliged to foot it, we must have run the gauntlet of a band of
robbers then infesting the country near Petrinia. As a rule our
Croatian friends were never tired of assuring us that it was beyond
the frontier that these gentry flourished; and the hilly country that
rose to the south-west—the Kraina, as the promontory of Turkish
territory is known, which acts as a thorn in the side of Austria—was
pointed out as a regular asylum for wild characters, and in fact was
long the only part of the frontier where the watch-service was still
needed. At the present moment, however, even the Croats were fain
to admit that Bosnia was free from robbers, while their own country
was insecure; and, indeed, I am afraid that this was not such an
exceptional state of things as they would have had us believe, for
when we arrived two days later in the Slavonian lands of the lower
Save we found the whole country under martial law, owing to the
murderous infestations of brigands in the Syrmian highlands; and
though several had been hanged, the reign of terror was such that
the military government was still continued. Indeed, just after the
Austro-Prussian war, the state of Croatia had become so deplorable
by reason of the increasing brigandage, that ‘Standrecht’ had to be
proclaimed there, and no less than forty robbers were hung. For
some time a gibbet with its ghastly appendages was to be seen from
the train on nearing Agram.
On the whole, then, it was more comfortable to indulge in such
reflections as we shot through the mighty oak-forest in a railway-
carriage bound for Siszek, than to sneak through these mysterious
shadows on foot with the feelings of one of our great-grandfathers,
when doomed to traverse Hampstead Heath on a dark night. These
Croatian highwaymen, however, immediately under notice, had
hitherto conducted the business of the road on the most
gentlemanly principles; and though a kind of ‘commercial’ with
whom we travelled seemed a bit scared, even he could report no
thrilling tales of bloodshed. There were sixteen of these Hajduks,
[162] as the Croats called them, who had taken to outlawry to avoid
the military conscription, which has just superseded the older
organisation of the Granitza. Soldiers have been in pursuit, but
fruitlessly, since not only are the hills about covered with
unfathomable forest and hollowed—so we were told—with caverns,
but the peasants, like those of Greece and Southern Italy, are in
league with the brigands, supplying them with food, and refusing to
reveal their hiding-places. The gendarmes, indeed, express hopes of
seizing their quarry when the leaves have fallen and the snow is on
the ground. Meantime they are at large. Nor let us judge too harshly
of their profession, for in this old world East of Europe the Hajduk is
often a gentleman in his way. ’Tis Robin Hood and his merry men
who still live on, roughly redressing their wrongs in a vicarious
fashion against that society which refuses them legal requital, but
capable none the less of much tenderness to women and children,
and discriminating their friends from the class that oppresses them.
Across the Turkish frontier the cause of national freedom, hopelessly
lost centuries ago on the battlefield, has been championed from
generation to generation by the Hajduks of the forest mountain, in
achievements not unsung by Sclavonic bards; and, likely enough,
these Croatian brothers are striving too for ancient liberties, as they
understand them.
It was late at night by the time we arrived at Siszek, so we were
glad enough to avail ourselves of a car bound for the ‘White Ship’
inn on the Kulpa Quay, in company with a Serbian lady and her child
—she disdaining not either for herself or boy the national costume of
Free Serbia. And verily she had her reward. For what could be more
appropriate than the rich silver embroidery flowered on the purple-
velvet field of her mantle—efflorescent with the poetic yearning of
the race for that gorgeous Orient, a yearning as lively as the
abhorrence from its yoke—an echo from the Serbian lyre—a protest
against your cold foggy West—but subdued withal by a Roman-
matronly coiffure wondrously becoming to the tranquil grace of
Serbian motherhood?
Arrived at our inn, we found ourselves plunged at once into
Turkish society, for many Bosnian corn-merchants from Bihac,
Serajevo, and other towns, betake themselves in the way of trade to
Siszek. Among the group of Turks who, in various awkward and frog-
like postures, were endeavouring to accommodate themselves to
chairs, was an Effendi, a title which implies not only a certain grade
of Turkish gentility, but an education for Bosnia most polite, namely,
the ability to read and write; and, what is by no means ordinary
among the Mussulman Sclaves of Bosnia, an acquaintance with
Osmanlì. Thus it was with a conscious sense of superiority that our
Effendi, learning our intentions in Bosnia, expressed a desire to see
the pass which the Vali Pashà had been good enough to supply us
with. He seemed extremely surprised to see that it was in the Vali’s
own handwriting; but having convinced himself of the fact, he first
read it aloud with pleasing gusto in the original Turkish, and then
translated it into Bosniac for the benefit of the Sclavonic
Mahometans and our Croatian landlord, with many assurances that
with such an ‘open sesamé’ we should have no difficulty in unlocking
the innermost fastnesses of Bosnia or even the Herzegovina, where
the revolt had now broken out.
There was also a venerable Turk of singularly dignified mien, with
patriarchal beard and capacious turban, who sat in mild
contemplation, lulled by the measured purring of his narghilé, lost to
all mundane concerns, sagely superior to the curiosity which our
pass and travelling gear were exciting in less exalted bosoms, and
benignantly indifferent even to the indignity of a chair. Our host told
us that he was a Hadji, or pilgrim, then on his way from Buda,
where he resided as a merchant, to Mecca.
Aug. 8.—Next morning we sallied forth to explore what might
remain of ancient Siscia. For we are now on classic ground. Siszek is
but the corruption of a name great in all ages of imperial Rome, and
greatest in the twilight of her empire. There was a time when Siscia
was one of the sovereign cities of the world. She was a bulwark
against barbarians, an emporium of commerce, a seat of emperors,
a mother of martyrs, a gathering point for Roman-Christian Saga.
And her older name, Segestica, takes us back to times prior to the
Roman conquest itself, when she formed part of that Celtic empire of
race, dim, commercial, reaching from Gades to the swamps of
Nether Rhine; from glacial Ierné to the mouths of Ister. Segestica!
we have no record of her dealings with the Adriatic votaries of
Belenus,[163] nor what Taurisk gold passed current in her streets;
and yet her peasant citizens of to-day plough up an abundance of
bronze-age sickles as if to bear witness of her old Celtic industry and
her very name calls up golden harvests of antiquity ready garnered
into her warehouses from rich Pannonian plains, with a side
suggestion perchance of her

Seges clypeata virorum,

that twice withstood the arms of Rome successfully, till Augustus


reduced her, and made of her a stationary camp for his cohorts.
She is now Siscia, a convenient point d’appui for Dacian
campaigns; the winter quarters for Tiberius in his Pannonian war; by
Septimius Severus made the seat of military government for his
world, and so benefited by him that she took the name of Septimia
Siscia. Probably under Vespasian,[164] a Roman colony had been
already planted here, and Siscia became a Republic with municipal
liberties modelled on those of the parent city. An inscription still
recalls her Duumviri, who, in Rome’s provincial mirrors, reflected the
two Consuls. Later on, Siscia becomes the chief city of Upper
Pannonia; then, when Savia was made a province, the residence of
its Corrector. She was the seat of an imperial treasury, and it was
here that the ‘most splendid Provost of the Ironworkers’ received the
revenue from Noric mines. Here, too, was established the Premier
Mint of the Roman Empire; and Siscia shares with Rome herself the
distinguished honour of first imprinting her name in full on the
imperial currency. What numismatist does not know and covet that
coin of Gallienus? or that choice piece of the Emperor who sprang
from her Savian rival Sirmium (though from this legend one would
think he was really of Siscia), with the proud inscription, ‘Siscia Probi
Aug.’—the Siscia of Probus? On it is to be seen the personification of
the queenly city, holding in her hands the laurel-wreath of empire,
while at her feet her two subject rivers pour bounteously from their
tributary urns.
But this medallic fertility, which has scattered the coins of Siscia
over the fields of remotest Britain, was only the natural result of her
commercial eminence. She was the staple of trade between the
Adriatic and the Danubian basin—old Celtic trade-routes probably
surviving the Roman conquest. ‘Siscia,’ says Strabo, ‘lies at the
confluence of many rivers, all navigable. It is at the foot of the Alps,
whose streams bear to it much merchandise, Italian and other.
These are borne in waggons from Aquileja over Ocra, the lowest
part of the Alps, to Nauportus, and thence by the Corcoras into the
Save,’—and so to Siscia. The wine and oil wafted from more
southern climes into the havens of that Venice of Roman Adria; the
carpets and woollens of Patavium that rumbled into her markets by
the Æmilian Way; the furs and amber that the barbarian dealers
bore her from the cold shores of the Baltic, and Fennic forests;
perhaps, too, her own costly wine stored up in wooden barrels—all
these, we may believe, and more, were piled on the Aquilejan
waggons and dragged up the Alpine steep by oxen, thence to be
floated down the Save to the Siscian wharves. In the markets of
Siscia the Aquilejese merchants might lay in their stock of grain, or
hides, or keen Noric steel, and take their pick of cattle, or tattooed
Illyrian slaves. From the whole of Eastern Europe wares might flow
together here; for not only was Siscia at the confluence of the Save
and Kulpa, but she was at the junction of great roads, which, with
their branches, connected her with the Upper and Lower Danube,
with the interior of Dalmatia as well as her coast-land, and with
Nauportus and Italy, overland.
Not long ago an interesting relic was found in Croatia, which
perhaps speaks more clearly than anything else of the majesty to
which Siscia ultimately attained. It is a cedarn chest, once gilt, on
which are carved, by a late Roman hand, what are meant to be
personifications of the five premier cities of the Roman world. In the
centre—

Prima urbes inter, Divum domus, Aurea Roma,[165]

Rome, with her usual attributes of helmet, spear, and shield, is


enthroned as a goddess. To her right two more female figures,
distinguished by scrolls as Constantinople and Carthage, hold
wreaths in their hands and look towards Rome. On her left, two
other goddess-cities do the same; one is Nicomedia, the other Siscia.
The carving is probably fourth-century work; and certainly, exalted
as is the position claimed on it for Siscia, it is almost borne out by
her coinage of the same period, for the activity of her mint shows
that her commercial splendour was still at its zenith down to at least
the days of Theodosius the Great; while the coins of her rival
Sirmium wax fewer and fewer, and finally cease altogether. For
Sirmium may have been of greater value as a military station,[166]
and perhaps a pleasanter residence for emperors and bishops, and
therefore of greater administrative importance, and of more frequent
mention by historians; but that she was a greater city than Siscia—
as is so confidently assumed by some writers—may reasonably be
doubted, and the very bustle of Siscian markets may have deterred
princes from fixing here their court.
The comparatively high state of Siscian civilisation is also attested
by her coins—those superb medallions of gold and silver—those
gems of the fourth-century monetary art that stand out among the
poorer products of mints Gallic and Britannic. But what distinguishes
the Siscian coins as much as their workmanship is their peculiarly
Christian character. It is here that the first purely Christian type—
that, namely, which alludes to the vision of Constantine, first makes
its appearance—indeed, during the fourth century the sacred
monogram may almost be regarded as a Siscian mint-mark. And we
know from other sources that Christianity had early struck root here;
for not only is its existence attested by two sepulchral inscriptions of
Roman date discovered here, but its vitality is celebrated by a
relation of Jerome and a hymn of Prudentius,[167] recording the
martyrdom of a Siscian citizen and bishop, Quirinus:—

Insignem meriti virum


Quirinum placitum Deo,
Urbis mœnia Sisciæ
Concessum sibi martyrem
Complexu patrio fovent.
It was during the persecution of Diocletian and ‘Duke’ Galerius, as
Prudentius styles him, that Quirinus, bishop of Siscia, refused to
burn incense on the heathen altar at the bidding of the Governor
Maximus, on the plea—countenanced, indeed, by inspired writers,
but which a little philology would have spared him—‘that all the gods
of the Gentiles were demons.’ ‘If you will allow,’ said Maximus, ‘that
the gods which the Roman Empire serves are powerful, you shall be
made priest to the great god Jove, otherwise you shall be sent to
Amantius, præfect of First Pannonia, and receive from him condign
sentence of death.’ The stout-hearted bishop, refusing these terms,
is sent to Sabaria, where he is tried and condemned in the theatre,
and with a millstone round his neck is thrown from the bridge above
into the river; when, lo! despite the weight of rock, the water
miraculously supports him:—

Dejectum placidissimo
Amnis vertice suscipit;
Nec mergi patitur sibi,
Miris vasta natatibus
Saxi pondera sustinens,

till, having exhorted the faithful and confounded the heathen from
his watery pulpit, his spirit ascends and the laws of gravity resume
their sway.
In the dark period which followed the barbarian invasions,
something of her old secular glory was still reflected in the Siscian
Church. After the destruction of Sirmium by the Huns in 441, Siscia
transferred her ecclesiastical allegiance to Salona. Her decline was
more lingering than that of her rival, for her prosperity had rested on
a more solid foundation. Her bishops survive the settlement of the
Sclaves hereabouts in the time of Heraclius. In the ninth century we
find her the residence of a Sclavonic prince; but she suffered from
the Frankish invasion, and in the tenth century was finally razed by
the Magyars. Now at last the Siscian episcopate dies out, to live
again with renewed splendour at Agram.
The old walls of Siscia are traced in a pear-shaped form on the left
bank of the Kulpa between it and the Save. But just outside our inn,
on the right bank of the river, we came upon several fragments of
old Siscia, some sculptures and inscriptions walled into the
foundations of modern houses. In the tympanum of a door are three
sculptures, one of which may be meant for Apollo, though only the
head and half the body survive, and another for Andromeda; these
two of base art; but the third, a griffin, of somewhat better work.
Here and there were stumps of columns, and Roman tiles might be
seen still in use. On the hill above, still on the right side of the Kulpa,
the wooden cottages almost always rested on foundations composed
of Roman blocks, amongst which many inscriptions may lie hid,
though we discovered none that had not already been
conscientiously described by Agram antiquaries. It was strange,
however, to observe how the irony of fate had converted to modern
utility the pomp of ancient funerals and the furniture of the ‘immortal
gods’! A Roman altar, with its face and what inscription there may
have been (for we could not get it raised), buried in the dust, had
been turned into a seat for Croat wives; a Roman sarcophagus in
one of the cottage yards had been converted into a horse-trough,
and another had been emended so as to form a serviceable sofa.
On the summit of the heights which here overlook the river is the
site of a Roman cemetery, and the owner of the vineyards where
most of the remains had been discovered kindly showed us over his
domain. Many fine sarcophagi—the best of which are to be seen in
the Agram museum—had been dug up here, containing the usual
amount of coins, lamps, urns, and ashes, amongst which the skull-
bones were most distinguishable. In one place we were shown a
Roman conduit, square in shape, and the outside glazed as if by a
conflagration. Near the old cemetery might be seen Roman walls,
and some cottage foundations consisting entirely of Roman tiles.
The most interesting Roman fragments were, however, on the left
side of the Kulpa, where the town walls are traceable, in a garden by
the railway-station. There we found an altar with an inscription[168]
showing that it was dedicated to Ceres, with a vase and patera
engraved on one side, and on the other a jar full of spikes of corn.
Close by lay mutilations of what once had been Corinthian capitals,
with rich acanthus-leaves decayed by many winters; fragments of a
marble frieze with wavy vine-sprays loaded with bunches of grapes
fit for the Land of Promise; besides, other marble bits on which were
sculptured beakers and telescopic flowers unknown to botanists, and
spiral knot-work which seemed almost Byzantine. It was pleasant to
believe that they all formed part of a temple of the corn-goddess,
though I doubt whether all the fragments could be attributed either
to the same building or the same age; and perhaps Father Liber or
Isis, whose altars have also been discovered here, may lay as good
claim to some of these vinous and floral devices as Mother Ceres.
But whatever view be taken, these remains are interesting as an
illustration of the old position of Siscia as centre of a corn and vine-
growing district; nor indeed are they inappropriate even to her
present state. The present town of Siszek derives what trade she
possesses mainly from the transport of cereals. Hither the maize and
wheat from the rich alluvial plains of the Banat and the Possávina, as
well as from the interior of Bosnia, are conveyed by the Save and its
tributaries; for Siszek is the point where the land-carriage to the
north and west commences, and she really stands to Trieste and
Fiume, with respect to the traffic between the Danubian basin and
the Adriatic, in much the same relation as her Roman ancestress
stood to Aquileja. Siszek has two really busy seasons in the year—in
the spring when the maize crop is gathered, and again the corn
harvest in August and September; and at these times her
population, normally reckoned at 3,800, rises to twice, or even, it is
said, to three times that number. The town, however, like many
other sites of Roman cities, is not so healthy as it was in former
times, and a curious plague of emerods is epidemic here. This
decrease of salubrity is attributed by the Siszekers themselves to the
great destruction of forests that has taken place in the
neighbourhood; with what reasons, let doctors decide.
However, modern science and drainage may probably be trusted
to remedy the present unhealthy state of the Siscian atmosphere;
and it requires no extraordinary gift of prophecy to be able to
foresee for Siszek a glorious future, and to predict that, before many
years are passed, she will have done much to regain the splendour
of Roman Siscia, whose functions, as we have seen, she still to a
certain extent performs. For she has been dowered with a situation
destined by nature for a great emporium of commerce, nor are signs
wanting that the fulfilment of her destiny is at hand. Already Siszek
is fixed as the point at which the railway that is to connect Western
Europe directly with Stamboul, and eventually perhaps the furthest
Orient, is to meet the lines leading to Vienna and Trieste, and
another line is projected, connecting Siszek directly with the Adriatic.
Siszek used to be divided by the Kulpa into the civil and military
towns, the latter under ‘regimental’ government; but since the new
legislation the whole has been placed under the municipal
authorities. In neither half is there anything worth seeing except the
Roman remains.
On the bank of the Kulpa, however, just at the confluence with the
Save, about a mile from Siszek, rises the old castle of Caprag, built
in a triangular form, with a round conical-roofed tower at each
corner. This castle brings home to us the old days when the Empire
was engaged in a life and death struggle with the Turk. It was built
in the sixteenth century, with the Emperor Ferdinand’s permission,
by the bishop and canons of Agram, and in 1592-3 it was gallantly
defended against the Pashà of Bosnia by two canons of the
cathedral chapter; till, after withstanding two sieges successfully, it
yielded to a third attempt, and for a year belonged to the Infidel.
[169]

As we were exploring the former military quarter of Siszek, whose


habitations, tenanted by the ordinary peasants of the Granitza, are
for the most part mere huts, as compared with the more stylish
houses of the civil town, our ears were saluted by sounds of
unearthly revelry proceeding from a neighbouring wine-shop.
Entering it, we found ourselves in the midst of a Croat merrymaking:
an orchestra of four men strumming on tamburas and tamburitzas
as for dear life, and accompanied by such a whisking, and whirling,
and stamping as never was! The dance they were engaged in when
we went in was known to them as the Kardatz, to the Germans as
‘Kroatisch’—though the Croats say that it was taught them by the
Magyars. Properly it was danced by the women alone, but there
were often enough male interlopers. It is so pretty that it deserves
to be known beyond the limits of Croatia; so I will give the general
arrangement of the dance, as far as I could catch it.
Six Croat maidens—any number divisible by six and two would do
as well—sorted themselves into two groups of three, which for
awhile seemed to ignore each other’s existence, the sisters of each
triad alternately dancing to one another, and then joining hands, like
three Graces as they were, and circling round; till of a sudden the
rival orbits seemed to feel each other’s influence, a quick
rapprochement took place, and all six, interlacing their arms, tripped
round in a fairy ring, faces outwards, till a starry disruption once
more surprised us, and in a twinkling the revolving orb was split up
into a new triad of twin constellations spinning round on their
separate axes, till it made one giddy to look at them—ribbons,
kerchiefs, and cometic plaits—and, sooth to say, the nebulous
envelopes of the statuesque!—flying off centrifugally.
The dance was in parts surprisingly graceful; and the dancers,
though mostly homely, were certainly prettier than the average
North-German Bauerin. Their hair was inclined to light shades which
one hardly expected to see in so southern a clime, and their eyes
were generally blue. There was one maiden, however, more comely
than the rest, with dark almond eyes and raven hair, of a strange
type, that one meets with now and again in South-Sclavonic regions;
a waif from the lands of the morning, an Oriental beauty shrouded in
no winding-sheet and entombed in no harem, but set off by the light
white muslin of Croatia.
Then there were other dances in which the men performed, which
were distinguished by stamping, and every now and then interrupted
by a comic ‘spoken.’ We heard some songs, too; such as one would
imagine might break from a flock of sheep if they were to burst into
spontaneous melody—a wearisome succession of baa-baas, varied at
intervals by an attempt to see how long they could keep on at one
note! The poverty of the instruments seemed to narrow the range of
the human voice.
Next morning betimes we bade farewell to Siszek, and took a
passage on the Save steamer for Brood, from which place we were
to begin our foot journey through Bosnia. During the early part of
the voyage there was little to see. Mud banks lined with willows,
now and then villages of dark timber, where, within the palings of
the large house-communities, were clustered together several
dwelling-houses of tea-caddy shape and somewhat pagoda-like
appearance, due to their having eaves projecting over the ground-
floor as well as the upper storey. The Save, as we enter it, takes a
muddier hue than the Kulpa, which at Siszek possessed something
of the emerald purity of a limestone stream. Opposite the confluence
of the Save and Unna was Jassenovac, taken and held for awhile by
the Pashà of Bosnia in 1536, after the battle of Mohacz; it is a small
town of about 1,100 inhabitants, and, being built on piles, is
sometimes called New Amsterdam. It might also recall the Swiss
lake-dwellings, to restorations of which many Granitza villages bear
a certain family likeness; but I doubt if the boats that float off
Jassenovac are not even more primitive than those of the old lake-
dwellers, for they are simply great oak-trunks hollowed out in a
Crusoe-like fashion. Further on we passed floating mills, paddle-
boats of Noah’s Ark-like construction anchored in the current, or left
behind us large flat barges which looked like giant cockchafers
turned over on their backs.
We are now on the watery boundary-line between Christendom
and Islâm, and the contrast between the two shores is one of the
most striking that can be imagined, recalling that between the
Bulgarian and Wallachian banks of the Lower Danube. On one side
Croat men, white tunicked and white breeked, with blue vests, and
fringes of homely lace to their trowsers; bare-legged women, with
the shortest of apron-skirts, washing their linen in the shallows,
coifed in the rosy Rubatz. Now and then a town, white houses and
bulbous church-spires, and citizens in the mourning hues of Western
civilisation. On the other bank minarets and narrow wooden streets,
gorgeous Turkish officials, brilliant maidens and mummied dames,
cheerful fezzes and red Bosnian turbans; and it is to be remarked
that the men on the Turkish bank, owing to their wearing such
comparatively shadeless head-gear, are distinctly more sunburnt
than the Slavonians of the Austrian side in their broad, black, felt
wideawakes. The one side was cold and dull, if comparatively clean;
the other dirty but magnificent.
Various types illustrative of the South Sclavonic world are to be
seen on deck: a Syrmian woman of an Oriental cast of feature
already spoken of, with dark hair and eyes, and a purple skirt; the
grave hadji whose acquaintance we had made at Siszek, who
vouchsafes me a majestic nod of recognition; a Dalmatiner—one of
those Italianised Sclaves who man the Austrian navy—with blue
sailor-blouse and bright red sash, sounds the shallows, when the
steamer slackens speed, with a long pole. A Slavonian of that
dissipated type which becomes more frequent as we approach
Syrmia, the mother-country of the famed plum-brandy—the Syrmian
slivovitz—with low eyebrows, a ferocious moustache and an
eminently Sclavonic nose, is caught by our artist napping, and
pocketed as below.[170] Beyond Gradisca we came to the prettiest
part of the river scenery, where the watery mirror reflects the
undulations of wooded hills; thence on and on through this
magnificent oak forest—some of the finest timber in all Europe—the
home of wolves and bears and sovereign eagles, and a few days
later to be the refuge of the panic-stricken Christian refugees of
Bosnia.
As we neared our destination the question arose whether we
should sleep in the Austrian or Turkish town of Brood; but we
decided, from a previous slight acquaintance with a Bosnian town,
that we were more likely to secure sleep on the Austrian side,
where, accordingly, we landed and put up at the comfortable ‘Red
House,’ and presently went out to take stock of the place. Slavonian
Brood is a large wooden village, more abominably paved, or rather
cobbled, than any town I remember. What especially struck us was
the chimneys, which are of every kind of shape and material, stone
and wooden, capped with canopies arched and peaked; and
suggesting in turn huts, towers, haystacks, tunnels, toadstools, and
umbrellas!
Now, whether it was the fact that we took out our sketch-books to
immortalise, so far as in us lay, these sooty orifices, or whether in
the way in which we eyed them there was something of the insidious
invader, certain it is that our motions did not escape the observation
of an active and intelligent gendarme, who ‘knew directly,’ as he
afterwards expressed it to a Croat who gave us the relation with
great glee, ‘that we were Russian spies.’ Acting on which supposition
with commendable alacrity, he came up and demanded our pass.
Now there is a natural tendency amongst Englishmen to resent such
a demand as an antiquated absurdity; but our official was so
honeyed in manner, so profuse of ‘bittes’ and protestations of
‘Pflicht,’ that we could not find it in our hearts to refuse to satisfy the
poor fellow’s curiosity. Whereupon our friend looked at the paper
and twisted it first to one side and then to another; and as he did
not understand one word of it, shook his head very wisely and
handed it to his mate, who, not understanding any more, shook his
head more sagely still, and handed it us back, professing—sly dog!—
that they were satisfied.
Those chimneys were ‘the beginnings of evils!’
We, however, had not recognised the first drops of the
thunderstorm, and, proceeding tranquilly on our way, strolled down
past an old church and monastery to the high bank overlooking the
Save. It was a beautiful picture!—a glorious sunset, crimson, golden,
opalescent, mirrored on the silvery expanse of quiet waters, broken
only by a small green island where stately oak-trees huddled
together in mid-flood like the giants of an older world;—far beyond
the sky-line, mingling with the mysterious blue of distant mountains;
on the Slavonian bank, pale rows of poplars and conical haystacks,
in relief against the dark fringe of primeval forest; on the further
side, a verandahed guardhouse and the tip of a minaret—a fore-
glimpse of another world—and hark! as the sun goes down, the
solemn tones of the muezzin are faintly borne by the evening breeze
to the shores of that Christendom which once rang with Allah akbar!
But we roused ourselves from the reveries which such a scene
could not fail to awaken, for the darkness was gathering, and a voice
within bade us seek the good cheer of our inn; when we were
arrested by the sounds of music and the sight of a booth near the
market-place, and, finding that a peep-show was going on, paid our
kreutzers and went in. A moonlight view of the Tuileries is hardly
what one would go to Brood to see, and we were beginning to think
the show a trifle dull, when the serenity of the sightseers was
broken in upon by the abrupt entry of two police-officers, and from
their evident designs on some person or persons unknown we were
congratulating ourselves on the prospect of a more lively spectacle.
These expectations were indeed justified by the two officials
pouncing upon L⸺ and myself, and ordering us to accompany
them immediately to the Commissär of Police.
‘Tell the Commissär of Police that if he wants to see us he had
better come himself,’ said I, who acted as our spokesman.
‘Very sorry, sir,’ said the official addressed, ‘but our orders were to
bring you.’
‘Tell him,’ I said, ‘that we are Englishmen, and are not accustomed
to be treated in this way!’
Here a Slavonian gentleman intervened. He said that there must
be some misunderstanding; that it was a most unfortunate
occurrence; but, in fact, these men had orders to arrest us if we did
not follow them at once.
Evidently, to avoid a row, there was nothing for it but to take his
advice; so we were marched along the streets of Brood with a
gendarme on each side of us, to all intents and purposes under
arrest; till at last, in no very accommodating humour, we arrived at
the official’s house, a long way off in the suburbs. Here we were
stumped through a court, and then ushered into a dirty little room,
where we found his highness seated at table in his shirt-sleeves,
chewing a Coriolanan meal of maize. He did not get up from his
chair to receive us, or even offer us a seat; but glancing at us in a
way which made us wish to knock him down and conclude the
business offhand, asked us in a surly and (we fancied) a slightly
husky voice who we were. ‘We are Englishmen,’ replied I, in German.
‘Give me your pass!’ shouted the Commissär in a still rougher tone;
‘what do you mean by entering the town without reporting
yourselves to me?’
To which I replied that he ought to know as well as we did that
travellers could pass from one town in the monarchy to another
without being subjected to such annoying regulations; but that, so
far as Brood was concerned, we had as a matter of fact already
shown our passes to two gendarmes. What was more, we need
scarcely inform him that at the present time Englishmen could pass
into Austria, just as Austrians into England, without a passport being
demanded. ‘And I think, sir,’ I added, ‘as you wished to see us, it
would have been more civil if you had called in person at our hotel.’
A Polizei-Commissär, bearded in his den by tramps and vagabonds
like us—it was too much for his petty Majesty! Any strictures on the
ceremonial of his state reception which I may have held in reserve,
were cut short by his roaring out, in a still more insufferable tone, ‘I
tell you I will see your pass!’
‘Sir,’ I replied, ‘just to prove to you that we are Englishmen, and
out of pure courtesy, we are willing to show you our pass; but we
must nevertheless protest that you have no right whatever to
demand it!’
‘No right!’ screamed the P.-C., almost choking with rage, and
bouncing from his chair with a spoon in one hand, and a maize-stalk
in the other. ‘I no right! We’ll soon see about that. Take them off!’ he
cried to his satellites; ‘take them off, I say, to the lock-up. Remove
him!’—as I attempted to insert the thin end of a protest, and hurled
a few consuls, ambassadors, thrones and dominions, at the official’s
head; while the gendarmes, seeing that it was a disgraceful
business, hesitated to carry out their chief’s commands—‘Do you
hear me? I tell you they shall pass the night in gaol. They shall show
me their pass to-morrow. Quick!’ And we left him muttering ‘No
right!’
Meanwhile rumours of the successful capture and impending
doom of two outrageous disturbers of the peace had spread
throughout the length and breadth of Brood, and all Brood was
rapidly assembling to see the majesty of the law vindicated on our
persons; so that when we were led forth again by the police, we
were followed through the streets by a kind of funeral cortége.
Presently we turned down another larger court, and, ascending
some steps, found ourselves on a raised platform outside the door of
our intended prison, from which I seized the opportunity of
addressing a kind of scaffold speech to the assembled soldiers and
people, which at least had the effect of delaying our incarceration.
I endeavoured to urge on them the seriousness of what was about
to take place. Two Englishmen, travelling under the protection of a
passport which they were willing to produce, were about to be cast
into a dungeon on the mere fiat of a petty magistrate. That for
ourselves, gross as was the indignity, we regretted it principally for
the sake of the Polizei-Commissär. That it would be but merciful to
allow him a short space for repentance; and here I sketched out
vaguely some of the tremendous consequences which such conduct
might bring down on his head. That they, too, the gendarmes, would
do well to think twice before lending a hand in such a business. That
Brood itself might rue the day; nor did I neglect this opportunity to
call up an apparition of a British fleet on the Save. Finally, I enquired
who was the highest authority in Brood, and hearing that it was the
Stadthauptmann, or Mayor, despatched a gendarme to beg that
functionary’s immediate attendance.
We flatter ourselves that this harangue was not without its effect
on our audience, who mostly understood German; but the minions
of the law must obey, and the police ushered us into a wretched cell
some seven feet by ten, quite dark, with a daïs of bare boards to
sleep on. We were allowed neither light, nor straw, nor water; and
when we asked for food—for we were very hungry, having tasted
nothing since noon, and it being now dusk—that was also refused,
till we offered a bribe to the officer, who then saw the matter in
quite a different light. He then left the dungeon, the iron bolt grated
in the lock, and we prepared to shift for the night as best we might.
Outside we heard a voice of weeping, proceeding apparently from a
woman and a child, as if touched at our sad fate—though L⸺
preferred to believe that the sobs were due to the prospective
annihilation of the Commissär. Had our sympathisers listened, they
would have heard a sound of chuckling within, which might have
been a considerable relief to their feelings.
Yet, we had not dined.
But our threats had begun to work on the official mind of Brood,
and, as it afterwards turned out, they were seconded by no less an
advocate than the leader of the National party in the Croatian Diet,
Dr. Makanec, who, fired with that enthusiasm for the cause of
freedom which shortly after led him to secede with his party from a
bureaucratic assembly, made such representations to the Mayor on
the outrageous conduct of the Commissär, and its probable
consequences, as moved his worship to immediate action.
Thus it was, that we had not been in durance vile half-an-hour
when hurried footsteps were heard in the court. The door of our cell
was thrown open, and the Stadthauptmann was before us, bowing
and scraping, and entreating us with the most profuse apologies to
step out. He protested that it was an unfortunate misunderstanding,
and as he had not offended us we were the more ready to grant him
pardon, and permitted ourselves to be escorted in triumph by his
whole posse comitatus down the street, his worship affecting the
most polite interest in our tour.
Thus we returned victoriously to our inn, where we were met by
our host, who had been expecting us for dinner for some time, with
the expressive question ‘Eingesperrt?’ (‘Locked up?’) ‘Eingesperrt!’
said I. ‘So was my waiter a day or two ago,’ continued our host.
‘What for?’ we demanded. ‘Ah! that I cannot tell you.’ ‘The fellow
ought to be shot!’ chimed in the aggrieved waiter. It appeared that
the Commissär was a petty tyrant in the place, and our successful
stand against his insolence created everywhere in Brood the liveliest
sensations of delight. But why should the Brooders have left it to
stray Englishmen to beard their despot? and which is the viler, the
people who knock under to such arbitrary treatment, or the
government which delegates to its officials the license to abuse the
personal liberties of its subjects? This is not the first time that, for an
equally paltry charge, I have seen the inside of an Austro-Hungarian
prison. The free life of the great cities of the empire deceives those
foreigners whose observations have been confined to the Prater;
what ought to be realised is, that while London in a sense extends
all over England, Pest and Vienna are bounded by their suburbs. The
truth is, that the Metternichian régime has not died out entirely in
the country districts. But when, as I believe was the case in this
instance, the traditions of the ‘Police-State’ are followed out by
Magyar—or at least Magyarizing—officials, there is less excuse for
such conduct, and the Hungarians should be warned that, by setting
up an alien and oppressive bureaucracy in their Sclavonic Provinces
they are not likely to retain the high opinion which their noble stand
against similar tyranny has won for them among Englishmen.
Head of Sclavonian.
CHAPTER III.
THROUGH THE BOSNIAN POSSÁVINA AND
USSORA.

Insurrectionary Agitation among Southern Sclaves—Proclamation of the Pashà of


Bosnia—We land in Turkish Brood—Moslem Children—Interview with the
Mudìr—Behaviour of our Zaptieh—Peasants of Greek Church—How these
Christians love one another—Arrive at Dervent—Interview with Pashà of
Banjaluka—Hajduks’ Graves—Rayah Hovel—Difficulty with our Host—Doboj;
its old Castle and Historical Associations—A South Sclavonic Patriot—First
Mountain Panorama—The ‘Old Stones,’ a prehistoric Monument—Tešanj: its
old Castle and History—‘Une Petite Guerre’—Latin Quarter of Tešanj—Soused
by an old Woman—Influence of Oriental Superstitions on Bosnian Rayahs—
Argument with the Kaïmakàm—Excusable Suspicions.

We spent the next forenoon in exploring some of the neighbouring


house-communities, a description of which has already been given;
and about twelve, after a parting wrangle concerning passports with
a sentry on the river bank, took our places in the ferry-boat that was
to convey us to the Turkish side of the Save. As the shores of
Christendom were receding from our view, we had leisure to reflect
on some slightly sensational topics which had lately been forcing
themselves on our attention. There could be no doubt that the
insurrection in the Herzegovina was at least holding its ground, and
that the agitation in the neighbouring Sclavonic lands was increasing
in intensity. A revolutionary committee had already been formed in
Agram, at Laibach, Spalato, and other Austrian towns. At Agram we
came in for a concert in aid of the insurgents; at Siszek there arrived
the same night as ourselves thirty Herzegovinians, who had left the
employments which they had in Free Serbia, and were hurrying to
aid their revolted brothers, while many Croats and Slovenes from
Agram, Marburg, Laibach, and other places were—so the Siszekers
assured us—also leaving for the seat of war. Vague rumours of
insurgent successes were afloat, and Siszek was thrown into a
considerable state of excitement by a report that Mostar and
Trebinje had both fallen into the hands of the Christians. We were
assured from many sides that if the insurrection were to spread a
little further, the rayahs of Bosnia would rise also; and fears were
entertained for the safety of the Christian minority in Serajevo, the
capital of Bosnia, and the head-quarters of Moslem fanaticism.
But what touched us more nearly was a proclamation which had
just appeared, signed by Dervish Pashà, the Turkish governor-
general of Bosnia, the authorship of which the wily Vali, later on,
thought fit to deny, but which for the present had the desired effect.
By it the whole of Bosnia was subjected to martial law, as well as the
Herzegovina, and its terms were vague and comprehensive enough
to legalise any violence. ‘It is my will,’ so ran the manifesto, ‘that
every true believer in the Prophet have the right to seize and bring
before me anyone suspected of taking part in the revolt, or of giving
aid to the enemies of our exalted master the Sultan. And I order that
all strangers direct themselves according to the laws of the country
during the insurrection, which probably will not long endure, for
already doth the sun of the insurgents verge towards its setting. And
assuredly’—we were informed in the poetic imagery of the East
—‘shall the lightning of the Sultan strike all who order not
themselves according to my will.’
‘But as to those who harbour the unruly, by the sword shall they
be cut off; and in all God’s houses subject to our jurisdiction shall
prayers be offered up for the help of God and the protection of the
prophet, on our exalted master the Sultan and his government.’
View on River Save, looking from Slavonian Brood towards the Bosnian Shore.

But for better or worse our Rubicon is passed, and we land on the
Turkish shore, among a group of turbaned gentry, from amongst
whom emerges a somewhat tattered soldier, who conducts us to the
square, verandahed, Karaula or guard-house. Here we are asked by
another official, in Italian, if we have anything to declare in our
knapsacks, and having satisfied him by a simple ‘Niente,’ we are
again beckoned on by our soldier, and follow him into the narrow
street of Turkish Brood to show our pass to the Præfect or Mudìr.
Our appearance created as great a sensation as was decorous
among the big-turbans of the townlet; crowds of Bosnian gamins
followed at our heels; and we caught a passing glimpse of a dusky
Ethiopian maiden white-toothing us in the most coquettish fashion
from behind a door. As the Mudìr was not at home, we had to wait in
the front room of his Konak,[171] if indeed a place which possesses
neither door nor window, and is completely open to the air on the
street side, can be called a room; and taking our seat on the
platform or raised floor—which in the other houses of the town, as
generally in Turkey, is used as the squatting-place of the
shopkeepers, and the counter on which to display their wares—
became the gazing-stock of a motley assemblage, who, crowding
round in the street, or taking reserved seats in the melon-shop
opposite, ‘twigged us’ at their leisure.
We, too, obtained a breathing space in which to realise in what a
new world we were. The Bosniacs themselves speak of the other
side of the Save as ‘Europe,’ and they are right; for to all intents and
purposes a five minutes’ voyage transports you into Asia. Travellers
who have seen the Turkish provinces of Syria, Armenia, or Egypt,
when they enter Bosnia, are at once surprised at finding the familiar
sights of Asia and Africa reproduced in a province of European
Turkey. Thrace, Macedonia, the shores of the Ægean, Stamboul
itself, have lost or never displayed many Oriental customs and
costumes; but Bosnia remains the chosen land of Mahometan
Conservatism, the Goshen of the faithful, ennobled by the tombs of
martyrs, and known in Turkish annals as the ‘Lion that guards the
gates of Stamboul.’ Fanaticism has struck its deepest roots among
her renegade population, and reflects itself even in their dress. In no
other European province of Turkey is the veiling of women so strictly
attended to. It is said that not long ago the fine egg-shaped turbans
of the Janissaries might still be found in Bosnia, and the Maulouka,
the most precious of all mantles, which had died out elsewhere, long
survived among these Bosnian Tories. As to the introduction of
fezzes, the Imperial order almost provoked a revolt here; and to this
day among Mahometans the fez is almost confined to officials, the
rest of the believers going about in the capacious turbans of the
East.
The very darkness of the background, the dirty narrow street, the
timber houses, the time-stained wooden minaret, acted as a foil to
the Oriental brilliance of the dress and merchandise, the scarlet
sashes, the gold embroidery, those gorgeous little maidens—doomed
most of them by sweet thirteen to take the winding-sheets of
Turkish matrimony, and bury their beauty in harems, where by
thirty-five they are turned old hags; but now, poor little butterflies!
fluttering out their brief child-glimpse of the world—light-smocked, in
linen chemises, chevroned with rainbow threads of colour—bagged
as to their legs, but beflowered with roses of Shiraz—pranked out
with gilt coin-bespangled fezzes, whence fountain-like the separate
jets of their tresses trickle forth in a score of silken plaits; Perilets,
with sisterly arms round each other’s necks, deigning to smile on the
strange Giaours. There, too, are their little brothers, showing more
of their slender legs, but gay as their sisters, in bags and tunics, with
pates not yet artificially baldened, but long-haired as the little
maidens, only in softer cascades, falling down their backs, and
fringing their foreheads. Capillati (Copi is still the word for boys
among the Roumans of East Europe)—one almost hoped to see a
bulla round their necks! and indeed I doubt not that they wore many
a potent spell against the Evil Eye.
There was one little lad of about five, with blue eyes and hair of
Scandinavian lightness, the cut of which called up some tiny page of
Charles the Second’s days, who, with some of his playmates,
crowded so near as to shut out the view of the two mysterious
Franks from the grave and reverend signiors behind, whereupon a
Turk, who happened to hold a small switch in his hand, came
forward and flicked these small flies away. The whip just touched our
small urchin, who moved out of the way with the others. He did not
cry, but more, as it seemed, in sorrow than in anger, fixed on his
flagellator a look of such childish dignity and grave surprise as
should have annihilated anyone less impassive than a Turk. It said,
as plainly as a look can speak, ‘I am not accustomed to such
treatment.’ The look of a child may seem a slight matter, but it was
eloquent of the tenderness with which the Turks treat children—a
tenderness which does them honour. Such an unkind cut was a new
experience in the little lad’s life.
When our observers had taken sufficient stock of us, the propriety
of showing us into an upper room of the Konak suggested itself to
some of them, and we were accordingly led upstairs, and invited to
squat in a den belonging to some subordinate official, who, while
waiting the Mudìr’s arrival, treated us to coffee. It was a very dirty
little room, in which the rags and tatters of an old piece of faded
carpet and rotten matting made shift for chairs and sofas; these,
with a stove such as has been described already, pigeon-holed with
pots, and a broken water-jar, completing the inventory of the
furniture. After a tedious delay, during which we supposed the
worthy præfect to be at his mid-day prayers, or more probably his
siesta, the Mudìr arrived, and we were ushered into his room of
state, distinguished from that of his sub. by containing a larger area
of dirt, and by displaying a larger piece of carpet with a more
capacious patch, but also by possessing a greasy divan on which we
were beckoned by the Mudìr to take our seat by his side. Our official
had turned out in grey clothes of European cut, and a regulation fez;
but as he could only speak Turkish, Arabic, and Bosniac, and as we
could none of these, an interpreter had to be found in the shape of
an Italian-speaking Dalmatian woman before we could hold much
communication. The Mudìr was well satisfied with our Bujuruldu; but
when we expressed our determination to walk through the country,
he was fairly taken aback. It was evidently a case which had never
before come within his official experience. There was no precedent
for such conduct. Nobody, he assured us, ever thought of travelling
on foot in Bosnia; if we wanted a horse or a waggon, he was ready
to oblige—but to walk! We had to explain that walking was a
weakness of English people; and at last, as I think the good man
began to believe that it was connected with our religion, and that we
were pilgrims of some sort, he gave over trying to convert us to the
Bosnian way of thinking, and told off a Zaptieh to escort us to our
that day’s destination, Dervent. Our attempts to rid ourselves from
having this encumbrance failed, as the autograph letter of the Pashà
made him responsible for our safety.
We left Turkish Brood, after first mollifying our Zaptieh with a
present of tobacco, and for a few miles followed the road along the
Save valley, stopping once to purchase at a roadside cottage some
sweet milk—slátko miléko. I have come upon some of our Sclavonic
cousins who could understand the English word! The homesteads
were very like the Croatian and Slavonian in general arrangement.
The common yard and paling, the wooden cottage roofed with long
shingles, and the various outhouses, were there, but the wickerwork
maize-garners were less capacious and more like large clothes-
baskets, and the whole was on a smaller scale. We heard that the
system of house-communities existed hereabouts to a much less
extent than on the Austrian side of the Save, but here and there as
many as three or four families are to be found in the same
homestead with a common house-father and house-mother. Round
each cottage were a number of plum-trees, and in each yard was a
small distillery for making Slivovitz. Further on, a Serbian merchant
drove up in an Arabà or native waggon, and courteously invited us
to take a quarter of an hour’s lift, which we accepted, though it was
sad jolty work, and we were not sorry to get out again.
Soon after passing a Turkish graveyard, with the usual turbaned
tombstones—some of the turbans of majestic height—we turned off
from the Save valley, and, leaving the road, waded across the Ukrina
stream, when to our astonishment the Zaptieh, instead of following,
stood shivering on the brink; but our surprise was turned to
indignation when the fellow shouted to a Christian woman, who was
passing along the other bank, to carry him across! We gave vent to
such forcible expressions of disapprobation as deterred the poor
woman from obeying my lord’s commands; but a rayah man coming
up, the Zaptieh, notwithstanding our indignant Jok! jok! (No! no!)
succeeded in requisitioning him, and in spite of all our gesticulations
the Christian carried over our escort on his back. When the Zaptieh
saw that we were very angry, he recompensed his bearer with a
handful of tobacco; and it must be owned that the Christian seemed
satisfied with the transaction, and that neither the leggings nor the
boots of the Zaptieh were adapted for rapid disembarrassment.
Further on we ascended a gentle chain of hills by delicious foot-
paths across hayfields, or amidst luxuriant crops of maize—through
oak-forests, and, what was stranger, woods of plum-trees laden with
small unripe fruit; and now and again along pretty country lanes,
where the hedges feasted us with a profusion of blackberries whose
size attested the richness of the soil, and whose flavour seemed to
combine all that was nicest in blackberry and mulberry. Both fields
and hedgerows were varied with a beautiful array of flowers,
amongst which I noticed yellow snapdragon, sky-blue flax, a sweet
flowering-rush, and a heath of wondrous aroma.
About sunset we stopped at a small shed on the banks of the
Ukrina, where, seated among a group of Christian peasants, we
regaled ourselves with black coffee which was being dispensed at
the rate of about a farthing a small cup. Hard by, fixed over the
Ukrina stream, was a water-mill for grinding corn, of the most
primitive construction, an idea of which is best given by the
accompanying diagram. These turbines are universal throughout
Bosnia, and are to be also seen in Croatia.

Plan of Turbine Mill.


The peasants here were mostly Vlachs, that is, they belonged to
the Greek Church. The men wore red and black turbans, a flowing
white linen tunic like the Croats, with a fringe of that coarse lace
which we had noticed in Slavonia. A leathern belt wound several
times round the waist served as a pocket for their smoking
apparatus; their trousers were worn loose and expansive as the
Croatian, sometimes close about the calf; their hair was sometimes
plaited together behind, and sometimes hung down in two elf-locks
—the crown of the head being shaven, as with the Turks. As to the
women, they were dressed in light tunics and aprons, much as
Croats and Slavonians, but their hair was often plaited like the men’s
into a single pig-tail. On their head was a white kerchief arranged in
a fashion peculiar to themselves, with a flower-like tassel at one
side; and they usually wore in front of the two necessary aprons a
superfluous black one with long fringe. Here is a Greek Christian girl
that we saw at a well, and who graciously allowed us to slake our
thirst from the bucket she had just drawn up.

You might also like