You are on page 1of 53

Java: The Complete Reference,

Eleventh Edition Herbert Schildt


Visit to download the full and correct content document:
https://textbookfull.com/product/java-the-complete-reference-eleventh-edition-herbert-
schildt/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Java: A Beginner’s Guide 7th Edition Herbert Schildt

https://textbookfull.com/product/java-a-beginners-guide-7th-
edition-herbert-schildt/

Java: A Beginner’s Guide, Eighth Edition Herbert


Schildt

https://textbookfull.com/product/java-a-beginners-guide-eighth-
edition-herbert-schildt/

Biota Grow 2C gather 2C cook Loucas

https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-
loucas/

Core Java Volume I - Fundamentals, Eleventh Edition


Safari

https://textbookfull.com/product/core-java-volume-i-fundamentals-
eleventh-edition-safari/
Java quick syntax reference Second Edition Olsson

https://textbookfull.com/product/java-quick-syntax-reference-
second-edition-olsson/

The Complete Rust Programming Reference Guide Rahul


Sharma

https://textbookfull.com/product/the-complete-rust-programming-
reference-guide-rahul-sharma/

Java EE 6 Pocket Guide A Quick Reference for Simplified


Enterprise Java Development 1st Edition Gupta Arun

https://textbookfull.com/product/java-ee-6-pocket-guide-a-quick-
reference-for-simplified-enterprise-java-development-1st-edition-
gupta-arun/

Maven: the complete reference edition 0.7, maven 2.2 ,


maven 3.0 Tim O’Brien

https://textbookfull.com/product/maven-the-complete-reference-
edition-0-7-maven-2-2-maven-3-0-tim-obrien/

Robot Operating System (ROS): The Complete Reference


(Volume 5) Anis Koubaa

https://textbookfull.com/product/robot-operating-system-ros-the-
complete-reference-volume-5-anis-koubaa/
About the Author
Best-selling author Herbert Schildt has written extensively about
programming for over three decades and is a leading authority on
the Java language. His books have sold millions of copies worldwide
and have been translated into all major foreign languages. He is the
author of numerous books on Java, including Java: A Beginner’s
Guide, Herb Schildt’s Java Programming Cookbook, Introducing
JavaFX 8 Programming, and Swing: A Beginner’s Guide. He has also
written extensively about C, C++, and C#. Although interested in all
facets of computing, his primary focus is computer languages.
Schildt holds both graduate and undergraduate degrees from the
University of Illinois. His website is www.HerbSchildt.com.

About the Technical Editor


Dr. Danny Coward has worked on all editions of the Java platform.
He led the definition of Java Servlets into the first version of the Java
EE platform and beyond, web services into the Java ME platform,
and the strategy and planning for Java SE 7. He founded JavaFX
technology and, most recently, designed the largest addition to the
Java EE 7 standard, the Java WebSocket API. From coding in Java,
to designing APIs with industry experts, to serving for several years
as an executive to the Java Community Process, he has a uniquely
broad perspective into multiple aspects of Java technology. In
addition, he is the author of two books on Java programming: Java
WebSocket Programming and Java EE: The Big Picture. Most
recently, he has been applying his knowledge of Java to solving
problems in the field of robotics. Dr. Coward holds a bachelor’s,
master’s, and doctorate in mathematics from the University of
Oxford.
Copyright © 2019 by McGraw-Hill Education (Publisher). All rights
reserved. Except as permitted under the United States Copyright Act
of 1976, no part of this publication may be reproduced or distributed
in any form or by any means, or stored in a database or retrieval
system, without the prior written permission of the publisher.

ISBN: 978-1-26-044024-9
MHID: 1-26-044024-9

The material in this eBook also appears in the print version of this
title: ISBN: 978-1-26-044023-2, MHID: 1-26-044023-0.

eBook conversion by codeMantra


Version 1.0

All trademarks are trademarks of their respective owners. Rather


than put a trademark symbol after every occurrence of a
trademarked name, we use names in an editorial fashion only, and
to the benefit of the trademark owner, with no intention of
infringement of the trademark. Where such designations appear in
this book, they have been printed with initial caps.

McGraw-Hill Education eBooks are available at special quantity


discounts to use as premiums and sales promotions or for use in
corporate training programs. To contact a representative, please visit
the Contact Us page at www.mhprofessional.com.

Oracle and Java are registered trademarks of Oracle Corporation


and/or its affiliates. All other trademarks are the property of their
respective owners, and McGraw-Hill Education makes no claim of
ownership by the mention of products that contain these marks.

Screen displays of copyrighted Oracle software programs have been


reproduced herein with the permission of Oracle Corporation and/or
its affiliates.
Information has been obtained by Publisher from sources believed to
be reliable. However, because of the possibility of human or
mechanical error by our sources, Publisher, or others, Publisher does
not guarantee to the accuracy, adequacy, or completeness of any
information included in this work and is not responsible for any
errors or omissions or the results obtained from the use of such
information.

Oracle Corporation does not make any representations or warranties


as to the accuracy, adequacy, or completeness of any information
contained in this Work, and is not responsible for any errors or
omissions.

TERMS OF USE

This is a copyrighted work and McGraw-Hill Education and its


licensors reserve all rights in and to the work. Use of this work is
subject to these terms. Except as permitted under the Copyright Act
of 1976 and the right to store and retrieve one copy of the work,
you may not decompile, disassemble, reverse engineer, reproduce,
modify, create derivative works based upon, transmit, distribute,
disseminate, sell, publish or sublicense the work or any part of it
without McGraw-Hill Education’s prior consent. You may use the
work for your own noncommercial and personal use; any other use
of the work is strictly prohibited. Your right to use the work may be
terminated if you fail to comply with these terms.

THE WORK IS PROVIDED “AS IS.” McGRAW-HILL EDUCATION AND


ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO
THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS
TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY
INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA
HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY
WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR
A PARTICULAR PURPOSE. McGraw-Hill Education and its licensors do
not warrant or guarantee that the functions contained in the work
will meet your requirements or that its operation will be
uninterrupted or error free. Neither McGraw-Hill Education nor its
licensors shall be liable to you or anyone else for any inaccuracy,
error or omission, regardless of cause, in the work or for any
damages resulting therefrom. McGraw-Hill Education has no
responsibility for the content of any information accessed through
the work. Under no circumstances shall McGraw-Hill Education
and/or its licensors be liable for any indirect, incidental, special,
punitive, consequential or similar damages that result from the use
of or inability to use the work, even if any of them has been advised
of the possibility of such damages. This limitation of liability shall
apply to any claim or cause whatsoever whether such claim or cause
arises in contract, tort or otherwise.
Contents at a Glance
Part I The Java Language
1 The History and Evolution of Java
2 An Overview of Java
3 Data Types, Variables, and Arrays
4 Operators
5 Control Statements
6 Introducing Classes
7 A Closer Look at Methods and Classes
8 Inheritance
9 Packages and Interfaces
10 Exception Handling
11 Multithreaded Programming
12 Enumerations, Autoboxing, and Annotations
13 I/O, Try-with-Resources, and Other Topics
14 Generics
15 Lambda Expressions
16 Modules
Part II The Java Library
17 String Handling
18 Exploring java.lang
19 java.util Part 1: The Collections Framework
20 java.util Part 2: More Utility Classes
21 Input/Output: Exploring java.io
22 Exploring NIO
23 Networking
24 Event Handling
25 Introducing the AWT: Working with Windows, Graphics,
and Text
26 Using AWT Controls, Layout Managers, and Menus
27 Images
28 The Concurrency Utilities
29 The Stream API
30 Regular Expressions and Other Packages
Part III Introducing GUI Programming with Swing
31 Introducing Swing
32 Exploring Swing
33 Introducing Swing Menus
Part IV Applying Java
34 Java Beans
35 Introducing Servlets
Part V Appendixes
A Using Java’s Documentation Comments
B Introducing JShell
C Compile and Run Simple Single-File Programs in One Step

Index
Contents
Preface

Part I The Java Language


Chapter 1 The History and Evolution of Java
Java’s Lineage
The Birth of Modern Programming: C
C++: The Next Step
The Stage Is Set for Java
The Creation of Java
The C# Connection
How Java Impacted the Internet
Java Applets
Security
Portability
Java’s Magic: The Bytecode
Moving Beyond Applets
A Faster Release Schedule
Servlets: Java on the Server Side
The Java Buzzwords
Simple
Object-Oriented
Robust
Multithreaded
Architecture-Neutral
Interpreted and High Performance
Distributed
Dynamic
The Evolution of Java
A Culture of Innovation
Chapter 2 An Overview of Java
Object-Oriented Programming
Two Paradigms
Abstraction
The Three OOP Principles
A First Simple Program
Entering the Program
Compiling the Program
A Closer Look at the First Sample Program
A Second Short Program
Two Control Statements
The if Statement
The for Loop
Using Blocks of Code
Lexical Issues
Whitespace
Identifiers
Literals
Comments
Separators
The Java Keywords
The Java Class Libraries
Chapter 3 Data Types, Variables, and Arrays
Java Is a Strongly Typed Language
The Primitive Types
Integers
byte
short
int
long
Floating-Point Types
float
double
Characters
Booleans
A Closer Look at Literals
Integer Literals
Floating-Point Literals
Boolean Literals
Character Literals
String Literals
Variables
Declaring a Variable
Dynamic Initialization
The Scope and Lifetime of Variables
Type Conversion and Casting
Java’s Automatic Conversions
Casting Incompatible Types
Automatic Type Promotion in Expressions
The Type Promotion Rules
Arrays
One-Dimensional Arrays
Multidimensional Arrays
Alternative Array Declaration Syntax
Introducing Type Inference with Local Variables
Some var Restrictions
A Few Words About Strings
Chapter 4 Operators
Arithmetic Operators
The Basic Arithmetic Operators
The Modulus Operator
Arithmetic Compound Assignment Operators
Increment and Decrement
The Bitwise Operators
The Bitwise Logical Operators
The Left Shift
The Right Shift
The Unsigned Right Shift
Bitwise Operator Compound Assignments
Relational Operators
Boolean Logical Operators
Short-Circuit Logical Operators
The Assignment Operator
The ? Operator
Operator Precedence
Using Parentheses
Chapter 5 Control Statements
Java’s Selection Statements
if
switch
Iteration Statements
while
do-while
for
The For-Each Version of the for Loop
Local Variable Type Inference in a for Loop
Nested Loops
Jump Statements
Using break
Using continue
Chapter 6 Introducing Classes
Class Fundamentals
The General Form of a Class
A Simple Class
Declaring Objects
A Closer Look at new
Assigning Object Reference Variables
Introducing Methods
Adding a Method to the Box Class
Returning a Value
Adding a Method That Takes Parameters
Constructors
Parameterized Constructors
The this Keyword
Instance Variable Hiding
Garbage Collection
A Stack Class
Chapter 7 A Closer Look at Methods and Classes
Overloading Methods
Overloading Constructors
Using Objects as Parameters
A Closer Look at Argument Passing
Returning Objects
Recursion
Introducing Access Control
Understanding static
Introducing final
Arrays Revisited
Introducing Nested and Inner Classes
Exploring the String Class
Using Command-Line Arguments
Varargs: Variable-Length Arguments
Overloading Vararg Methods
Varargs and Ambiguity
Local Variable Type Inference with Reference Types
Chapter 8 Inheritance
Inheritance Basics
Member Access and Inheritance
A More Practical Example
A Superclass Variable Can Reference a Subclass
Object
Using super
Using super to Call Superclass Constructors
A Second Use for super
Creating a Multilevel Hierarchy
When Constructors Are Executed
Method Overriding
Dynamic Method Dispatch
Why Overridden Methods?
Applying Method Overriding
Using Abstract Classes
Using final with Inheritance
Using final to Prevent Overriding
Using final to Prevent Inheritance
Local Variable Type Inference and Inheritance
The Object Class
Chapter 9 Packages and Interfaces
Packages
Defining a Package
Finding Packages and CLASSPATH
A Short Package Example
Packages and Member Access
An Access Example
Importing Packages
Interfaces
Defining an Interface
Implementing Interfaces
Nested Interfaces
Applying Interfaces
Variables in Interfaces
Interfaces Can Be Extended
Default Interface Methods
Default Method Fundamentals
A More Practical Example
Multiple Inheritance Issues
Use static Methods in an Interface
Private Interface Methods
Final Thoughts on Packages and Interfaces
Chapter 10 Exception Handling
Exception-Handling Fundamentals
Exception Types
Uncaught Exceptions
Using try and catch
Displaying a Description of an Exception
Multiple catch Clauses
Nested try Statements
throw
throws
finally
Java’s Built-in Exceptions
Creating Your Own Exception Subclasses
Chained Exceptions
Three Additional Exception Features
Using Exceptions
Chapter 11 Multithreaded Programming
The Java Thread Model
Thread Priorities
Synchronization
Messaging
The Thread Class and the Runnable Interface
The Main Thread
Creating a Thread
Implementing Runnable
Extending Thread
Choosing an Approach
Creating Multiple Threads
Using isAlive( ) and join( )
Thread Priorities
Synchronization
Using Synchronized Methods
The synchronized Statement
Interthread Communication
Deadlock
Suspending, Resuming, and Stopping Threads
Obtaining a Thread’s State
Using a Factory Method to Create and Start a Thread
Using Multithreading
Chapter 12 Enumerations, Autoboxing, and Annotations
Enumerations
Enumeration Fundamentals
The values( ) and valueOf( ) Methods
Java Enumerations Are Class Types
Enumerations Inherit Enum
Another Enumeration Example
Type Wrappers
Character
Boolean
The Numeric Type Wrappers
Autoboxing
Autoboxing and Methods
Autoboxing/Unboxing Occurs in Expressions
Autoboxing/Unboxing Boolean and Character Values
Autoboxing/Unboxing Helps Prevent Errors
A Word of Warning
Annotations
Annotation Basics
Specifying a Retention Policy
Obtaining Annotations at Run Time by Use of
Reflection
The AnnotatedElement Interface
Using Default Values
Marker Annotations
Single-Member Annotations
The Built-In Annotations
Type Annotations
Repeating Annotations
Some Restrictions
Chapter 13 I/O, Try-with-Resources, and Other Topics
I/O Basics
Streams
Byte Streams and Character Streams
The Predefined Streams
Reading Console Input
Reading Characters
Reading Strings
Writing Console Output
The PrintWriter Class
Reading and Writing Files
Automatically Closing a File
The transient and volatile Modifiers
Using instanceof
strictfp
Native Methods
Using assert
Assertion Enabling and Disabling Options
Static Import
Invoking Overloaded Constructors Through this( )
A Word About Compact API Profiles
Chapter 14 Generics
What Are Generics?
A Simple Generics Example
Generics Work Only with Reference Types
Generic Types Differ Based on Their Type
Arguments
How Generics Improve Type Safety
A Generic Class with Two Type Parameters
The General Form of a Generic Class
Bounded Types
Using Wildcard Arguments
Bounded Wildcards
Creating a Generic Method
Generic Constructors
Generic Interfaces
Raw Types and Legacy Code
Generic Class Hierarchies
Using a Generic Superclass
A Generic Subclass
Run-Time Type Comparisons Within a Generic
Hierarchy
Casting
Overriding Methods in a Generic Class
Type Inference with Generics
Local Variable Type Inference and Generics
Erasure
Bridge Methods
Ambiguity Errors
Some Generic Restrictions
Type Parameters Can’t Be Instantiated
Restrictions on Static Members
Generic Array Restrictions
Generic Exception Restriction
Chapter 15 Lambda Expressions
Introducing Lambda Expressions
Lambda Expression Fundamentals
Functional Interfaces
Some Lambda Expression Examples
Block Lambda Expressions
Generic Functional Interfaces
Passing Lambda Expressions as Arguments
Lambda Expressions and Exceptions
Lambda Expressions and Variable Capture
Method References
Method References to static Methods
Method References to Instance Methods
Method References with Generics
Constructor References
Predefined Functional Interfaces
Chapter 16 Modules
Module Basics
A Simple Module Example
Compile and Run the First Module Example
A Closer Look at requires and exports
java.base and the Platform Modules
Legacy Code and the Unnamed Module
Exporting to a Specific Module
Using requires transitive
Use Services
Service and Service Provider Basics
The Service-Based Keywords
A Module-Based Service Example
Module Graphs
Three Specialized Module Features
Open Modules
The opens Statement
requires static
Introducing jlink and Module JAR Files
Linking Files in an Exploded Directory
Linking Modular JAR Files
JMOD Files
A Brief Word About Layers and Automatic Modules
Final Thoughts on Modules

Part II The Java Library


Chapter 17 String Handling
The String Constructors
String Length
Special String Operations
String Literals
String Concatenation
String Concatenation with Other Data Types
String Conversion and toString( )
Character Extraction
charAt( )
getChars( )
getBytes( )
toCharArray( )
String Comparison
equals( ) and equalsIgnoreCase( )
regionMatches( )
startsWith( ) and endsWith( )
equals( ) Versus ==
compareTo( )
Searching Strings
Modifying a String
substring( )
concat( )
replace( )
trim( ) and strip( )
Data Conversion Using valueOf( )
Changing the Case of Characters Within a String
Joining Strings
Additional String Methods
StringBuffer
StringBuffer Constructors
length( ) and capacity( )
ensureCapacity( )
setLength( )
charAt( ) and setCharAt( )
getChars( )
append( )
insert( )
reverse( )
delete( ) and deleteCharAt( )
replace( )
substring( )
Additional StringBuffer Methods
StringBuilder
Chapter 18 Exploring java.lang
Primitive Type Wrappers
Number
Double and Float
Understanding isInfinite( ) and isNaN( )
Byte, Short, Integer, and Long
Character
Additions to Character for Unicode Code Point
Support
Boolean
Void
Process
Runtime
Memory Management
Executing Other Programs
Runtime.Version
ProcessBuilder
System
Using currentTimeMillis( ) to Time Program
Execution
Using arraycopy( )
Environment Properties
System.Logger and System.LoggerFinder
Object
Using clone( ) and the Cloneable Interface
Class
ClassLoader
Math
Trigonometric Functions
Exponential Functions
Rounding Functions
Miscellaneous Math Methods
StrictMath
Compiler
Thread, ThreadGroup, and Runnable
The Runnable Interface
Thread
ThreadGroup
ThreadLocal and InheritableThreadLocal
Package
Module
ModuleLayer
RuntimePermission
Throwable
SecurityManager
StackTraceElement
StackWalker and StackWalker.StackFrame
Enum
ClassValue
The CharSequence Interface
The Comparable Interface
The Appendable Interface
The Iterable Interface
The Readable Interface
The AutoCloseable Interface
The Thread.UncaughtExceptionHandler Interface
The java.lang Subpackages
java.lang.annotation
java.lang.instrument
java.lang.invoke
java.lang.management
java.lang.module
java.lang.ref
java.lang.reflect
Chapter 19 java.util Part 1: The Collections Framework
Collections Overview
The Collection Interfaces
The Collection Interface
The List Interface
The Set Interface
The SortedSet Interface
The NavigableSet Interface
The Queue Interface
The Deque Interface
The Collection Classes
The ArrayList Class
The LinkedList Class
The HashSet Class
The LinkedHashSet Class
The TreeSet Class
The PriorityQueue Class
The ArrayDeque Class
The EnumSet Class
Accessing a Collection via an Iterator
Using an Iterator
The For-Each Alternative to Iterators
Spliterators
Storing User-Defined Classes in Collections
The RandomAccess Interface
Working with Maps
The Map Interfaces
The Map Classes
Comparators
Using a Comparator
The Collection Algorithms
Arrays
The Legacy Classes and Interfaces
The Enumeration Interface
Vector
Stack
Dictionary
Hashtable
Properties
Using store( ) and load( )
Parting Thoughts on Collections
Chapter 20 java.util Part 2: More Utility Classes
StringTokenizer
BitSet
Optional, OptionalDouble, OptionalInt, and
OptionalLong
Date
Calendar
GregorianCalendar
TimeZone
SimpleTimeZone
Locale
Random
Timer and TimerTask
Currency
Formatter
The Formatter Constructors
The Formatter Methods
Formatting Basics
Formatting Strings and Characters
Formatting Numbers
Formatting Time and Date
The %n and %% Specifiers
Specifying a Minimum Field Width
Specifying Precision
Using the Format Flags
Justifying Output
The Space, +, 0, and ( Flags
The Comma Flag
The # Flag
The Uppercase Option
Using an Argument Index
Closing a Formatter
The Java printf( ) Connection
Scanner
The Scanner Constructors
Scanning Basics
Some Scanner Examples
Setting Delimiters
Other Scanner Features
The ResourceBundle, ListResourceBundle, and
PropertyResourceBundle Classes
Miscellaneous Utility Classes and Interfaces
The java.util Subpackages
java.util.concurrent, java.util.concurrent.atomic, and
java.util.concurrent.locks
java.util.function
java.util.jar
java.util.logging
java.util.prefs
java.util.regex
java.util.spi
java.util.stream
java.util.zip
Chapter 21 Input/Output: Exploring java.io
The I/O Classes and Interfaces
File
Directories
Using FilenameFilter
The listFiles( ) Alternative
Creating Directories
The AutoCloseable, Closeable, and Flushable Interfaces
I/O Exceptions
Two Ways to Close a Stream
The Stream Classes
The Byte Streams
InputStream
OutputStream
FileInputStream
FileOutputStream
ByteArrayInputStream
ByteArrayOutputStream
Filtered Byte Streams
Buffered Byte Streams
SequenceInputStream
PrintStream
DataOutputStream and DataInputStream
RandomAccessFile
The Character Streams
Reader
Writer
FileReader
FileWriter
CharArrayReader
CharArrayWriter
BufferedReader
BufferedWriter
PushbackReader
PrintWriter
The Console Class
Serialization
Serializable
Externalizable
ObjectOutput
Another random document with
no related content on Scribd:
ON DEATH OF PUSHKIN.

Silent the sounds of wondrous songs;


Their latest notes have pealed;
Narrow and dim his resting-place,
The singer’s lips are sealed.
DREAM.[1]

’Neath midday heat, in Dagestána’s Vale,


With leaden ball in breast I lifeless lay;
From a deep wound smoke rose upon the gale,
And drop by drop my life-blood ebbed away.

Alone I lay upon the sandy slopes;


The craggy cliffs around me crowded steep;
The sunlight burned upon their yellow tops,
And burned on me who slept no mortal sleep.

A dream I dreamed, and saw in sparkling bowers


An evening feast in my home—far away—
Where young and lovely women, crowned with flowers,
Conversed of me in accents light and gay.

But, in their happy talk not joining, one


Sat far apart, and plunged in thought she seemed;
And oh!—the mystery knows God alone—
This was the dream her young soul sadly dreamed.

She saw in vision Dagestána’s Vale,


Where on the slope a well-known body lay;
From the black wound smoke rose upon the gale,
And in cold streams the life-blood ebbed away.

FOOTNOTES:
[1] This poem partakes of a prophecy. Lermontof was himself
killed in a duel on the slopes of the Caucasus.
CLOUDS.
(AN EXPERIMENT IN RUSSIAN DACTYLS.)

Cloudlets ethereal wandering ceaselessly,


Floating in pearly chains over the azure deep;
Maybe, as even I, suffering banishment,[2]
Leaving your own dear North, southward perforce you sweep.

What is compelling you? Destiny’s ordinance?


Envy invisible? Open iniquity?
Maybe deeds criminal heavily press on you;
Maybe the slander of friendship’s obliquity.

No! you are simply aweary of fruitless fields;


Strangers to passions and strangers to punishment.
Frigid eternally, free everlastingly,
You have no country, and cannot know banishment!

FOOTNOTES:
[2] Lermontof was banished from St. Petersburg to the
Caucasus.
PRAYER.
(AN EXPERIMENT IN RUSSIAN DACTYLS.)

Praying now earnestly, Mother of God, come I,


Bending before thy shrine radiant in brilliancy,
Not for salvation, or battle-eve benison,
Not with thanksgiving, or even repentancy.

Not for my own sad soul lost in the wilderness,


Soul of a pilgrim here wandering homelessly;
But for a maiden pure, whom I would trust to thee,
Fervid Protectress from cold inhumanity!

Circle with Fortune this maiden deserving it;


Grant her considerate friends on life’s pilgrimage,
Youth of bright buoyancy, age of reposefulness;
Grant to her sinless soul Hope’s happy peacefulness.

Then—when the farewell hour finally draweth nigh,—


Whether in morn’s hum, or silence of eventide,—
Send forth the best of thine angels to take to thy
Bosom of mercy her peerlessly perfect soul!
HOW WEARY! HOW DREARY!

How weary! how dreary! with no friend to ease the heart’s pain
In moments of sorrow of soul!
Fond desires! But what use the desire that is ever in vain?
And o’er us the best years roll.

To love. But the loved one? ’Tis nothing to love for a space;
And for ever Love cannot remain.
Dost thou glance at thyself? Of the “has been” remains not a trace,
And all gladness and sorrow are vain.

The passions? Ah! sooner or later, their malady sweet


Will vanish at reason’s behest;
And life—when the circle of cold contemplation’s complete—
Is a stupid and frivolous jest.

Alone I pass along the lonely road,


Thro’ gathering mist the pebbly pathway gleams;
The night is still;—the void remembers God,
And star vibrates to star with speaking beams.

A wondrous glory moves across the sky;


Soft sleeps the earth in dove-grey azure light.
Why aches my heart? Why troubled thus am I?
What wait I for, what grieve I for, this night?

No more from life can I expect to gain,


And for the “has been” it were vain to weep;
I simply seek repose, release from pain,
And fain would rest, forgetting all, in sleep.

But not the sleep which the cold tomb implies;


But rather would I rest for ages so
That in my breast the strength of life might rise
In gentle wavelets, heaving to and fro.

The while that in my ears by night and day,


A sweet voice sang of ceaseless love to me;
And o’er me leaned, greening in every spray
And faintly whispering, my dark cedar[3] tree.

FOOTNOTES:
[3] Lit., “oak.”

One wave upon another leaps,


And splashes, murmuring loud;
So men on men, in rolling heaps,
Press on—a worthless crowd.

The waves prefer their cold free-will


To warmth the noonday gave;
Souls men desire to have, yet still
They’re colder than the wave.
BALLAD.
THE QUEEN OF THE SEA.

The young Prince is swimming his steed in the sea;


He heareth a voice: “Oh, Prince, look upon me!”

Loud snorteth the steed as he pricks up his ears;


He splashes the foam as he plunges and rears.

Again hears the Prince: “A king’s daughter I be;


Art thou willing to pass the whole evening with me?”

Behold, from the water a white hand extends,


And catches the reins by their silk tassel-ends.

To the white hand a young face there quickly succeeds;


In her locks are entangled the twisted seaweeds.

Her blue eyes are gleaming with love’s wild delight;


On her bosom the foam-drops like pearls sparkle bright.

Then thinketh the Prince, “You must stay, lady fair;”


And adroitly he windeth his hand in her hair.

He has caught her. The hand of the warrior’s strong;


She weeps and she prays as they struggle along.

The Prince to the shore swimmeth on in his pride;


He lands, and loud calls he his friends to his side.

“Ho! come, my brave comrades, and look at my prey.


Behold how she struggles! She’ll ne’er get away.

“Why stand ye a terrified group on the shore?


Ye have ne’er seen a beauty like this one before.”
Back glanceth the Prince, with delight, on his prize;
But the proud look of triumph soon fades from his eyes.

With a shudder he sees on the golden sand trail


A fearsome sea-monster, with hideous green tail—

A tail covered over with scales like a snake,


Its quivering coils in death-agony shake.

The foam from her forehead is pouring in streams,


And the darkness of death from her closing eye gleams;

Her pale hands are clutching the sands of the sea,


And of purport unknown a reproach whispers she.

Afar rides the Prince—deep in thought rideth he;


For long years he’ll remember “the Queen of the Sea.”
THE PROPHET.

Since the Eternal Judge to me


The Prophets’ power of vision lent,
In human eyes I read, and see
Pages of vice and folly blent.

To preach of love when I began,


Teaching of truth and purity,
My neighbours all, like devils, ran
And took up stones to throw at me.

Upon my head I ashes cast,


And from the towns, a beggar, fled;
And now I dwell in deserts vast,
Just like the birds, by God’s hand fed.

Keeping the laws of Providence,


The brute creation serveth me;
The stars hear me with confidence,
With bright rays playing joyously.

When through the noisy city’s way


I hurry onwards, in distraction,
The old men to the children say,
With smile of selfish satisfaction—

“Behold, from him a warning take!


He was too proud with us to dwell;
The fool! That God through his lips spake—
This was the tale he strove to tell.
“Look, children! on him cast your eyes!
How sad he is! how thin and pallid!
How naked, and how poor and squalid!
How all the wretched man despise!”
WHEN—THEN.

When waves of shadow fret the yellowing fields;


When freshly hum the woods to Zephyr’s play;
When on the garden walls the reddening plums,
Hiding themselves, in leafy ambush sway;

When freshly washed in heavy-scented dews


(While evening red or golden morning glows),
From ’neath the hedge to me, with welcoming bows,
Her silver head the waving lily shows;

When sports the snow-cold runlet down the dale,


Plunging my restless thoughts in pensive dreams,
Whispering to me some deep mysterious tale
Of that reposeful source from whence it streams;—

Then in my soul calm peace succeeds alarm,


Upon my brow dissolves the furrowed frown;
On earth I catch of happiness the charm;
From heaven I see the Godhead looking down.
MY NATIVE LAND.

I love my land, but with a love so strange


That reason over it no victory knows.
Her glory, bought in bloodshed’s stern exchange,
Her ever-confident and proud repose,
The sacred annals of her ancient might,
Arouse in me no fancies of delight.

Nay! but I love (the why I cannot say)


Her cold steppes in their silent majesty,
Her waving woodlands in their boundless play,
Her flooded rivers spreading like the sea.
I love to drive adown her country lanes,
With longing glance piercing the shades of night,
Sighing for rest, to catch thro’ distant panes
The glimmering of some mournful village light.
I love to see the smoke of smouldering stalk;
To watch the waggons o’er the wide waste wend;
Or, on hillside, ’mid yellowing fields, to mark
The pair of birch trees their white arms extend.
With a delight, unknown except to few,
Love I to note the well-filled threshing-floor,
The peasant’s hut, half hidden in the straw,
The shutters with quaint carvings covered o’er;
And with no less delight, on holiday,
From dewy eve till noon of night, to gaze
Upon the dance, with stamp and whistling gay,
Amid the roar the merry rustics raise.
TO ——.

We stand apart, yet still thy pictured face


I fondly press to this sad heart of mine—
A vision pale, of happiest years a trace,
My soul rejoices in this gift of thine.

For, though to passions new I’m now resigned,


That once-loved face I cannot cease to love;
The shrine forsaken still retains the shrined;
O’erthrown the image, yet God reigns above.
THE DAGGER.

Well do I love thee, my dagger of steel,


My comrade so bright and so cold!
Thou wast forged in hate by a Georgian fell,
For the fierce fight edged by Circassian bold.

Thee to me as a gift did a lily hand bear


In the moment of sad farewell;
For that once no blood, but a glittering tear,
A pearl of passion, adown thee fell.

Fixed upon mine, her dark black eyes


Full of mysterious sorrow seemed;
As plays thy blade when flickering flames arise,
Darkling they gloomed, and then they brightly gleamed.

Dumb pledge of love to cheer my cheerless way,


To wanderer lone a useful guide,
My strength of soul I never shall betray,
But true like thee, true steel, will I abide!

No! not for thee flames thus my love’s hot blast;


Thy brilliant beauty is not thine for me.
In thee I love a passion of the past;
My long-lost youth I live again in thee.

For when at times entranced I gaze upon thee,


Fixing on thy bright eyes a yearning glance,
To thee my heart is silent, while beyond thee
With her I hold mysterious utterance.

I speak with her, my friend of earlier blisses;


In your soft lines another’s form I trace.
On living lips I press long-silent kisses;
In your sweet eyes I see a vanished face.
DISPUTE.[4]

Once, before a tribal meeting


Of the mountain throng,
Kazbek-hill with Shat-the-mountain[5]
Wrangled loud and long.
“Have a care, Kazbek, my brother,”
Shat, the grey-haired, spoke;
“Not for naught hath human cunning
Bent thee to the yoke.
Man will build his smoky cabins
On thy hillside steep;
Up thy valley’s deep recesses
Ringing axe will creep;
Iron pick will tear a pathway
To thy stony heart,
Delving yellow gold and copper
For the human mart.
Caravans, e’en now, are wending
O’er thy stately heights,
Where the mists and kingly eagles
Wheeled alone their flights.
Men are crafty; what though trying
Proved the first ascent,
Many-peopled, mark, and mighty
Is the Orient.”
“Nay, I do not dread the Orient,”
Kazbek, answering, jeers;
“There mankind has spent in slumber
Just nine hundred years.
Look, where ’neath the shade of plane trees
Sleepy Georgians gape,
Spilling o’er their broidered clothing
Foam of luscious grape!
See, ’mid wreaths of pipe-smoke, lying
On his flowered divan,
By the sparkling pearly fountain
Dozeth Teheran!
“Lo! around Jerusalem’s city,
Burned by God’s command,
Motionless, in voiceless stillness,
Death-like, lies the land.

“Farther off, to shade a stranger,


Yellow Nilus laves,
Glowing in the glare of noonday,
Steps of royal graves.
Bedouins forget their sorties
For brocaded tents,
While they count the stars and sing of
Ancestral events.
All that there the vision greeteth
Sleeps in prized repose;
No! the East will ne’er subdue me;
Feeble are such foes!”

“Do not boast thyself so early,”


Answered ancient Shat;
“In the North, look! ’mid the vapours,
Something rises! What?”
Secretly the mighty Kazbek
At this warning shook,
And, in trouble, towards the nor’ward
Cast a hurried look.
As he looks, in perturbation,
Filled with anxious care,
He beholds a strange commotion,
Hears a tumult there.
Lo! from Ural to the Danube,
To the mighty stream,
Tossing, sparkling in the sunlight,
Moving regiments gleam;
Glancing wave the white-plumed helmets
Like the prairie grass,
While, ’mid clouds of dust careering,
Flashing Uhlans pass.
Crowded close in serried phalanx
War battalions come;
In the van they bear the standards,
Thunders loud the drum;
Streaming forth like molten copper
Batteries, rumbling, bound;
Smoking just before the battle
Torches flare around;
Skilled in toils of stormy warfare,
Heading the advance,
See! a grey-haired general guides them,
Threat’ning is his glance.
Onwards move the mighty regiments
With a torrent’s roar;
Terrible, like gathering storm-clouds,
East, due east, they pour.
Then, oppressed with dire forebodings,
Filled with gloomy dreams,
Strove Kazbek to count the foemen,
Failed to count their streams.
Glancing on his tribal mountains,
Sadly gloomed the hill;
Drew across his brows his mistcap,
And for aye was still.

FOOTNOTES:
[4] This piece is famous for the description it contains of
Russia’s progress eastward.
[5] Two mountains in the Caucasian range subdued by Russia
with the rest of the Caucasus.

You might also like