Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (4 votes)
40 views

(eBook PDF) Introduction to Java Programming and Data Structures, Comprehensive Version, 11th Global Editionpdf download

The document provides information about various editions of eBooks related to Java programming and data structures, including links for download. It outlines the structure of the comprehensive version of a Java programming textbook, detailing its five parts covering fundamentals, object-oriented programming, GUI programming, data structures and algorithms, and advanced Java programming. Additionally, it mentions supplementary resources available for both students and instructors through a companion website.

Uploaded by

ariektutt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
40 views

(eBook PDF) Introduction to Java Programming and Data Structures, Comprehensive Version, 11th Global Editionpdf download

The document provides information about various editions of eBooks related to Java programming and data structures, including links for download. It outlines the structure of the comprehensive version of a Java programming textbook, detailing its five parts covering fundamentals, object-oriented programming, GUI programming, data structures and algorithms, and advanced Java programming. Additionally, it mentions supplementary resources available for both students and instructors through a companion website.

Uploaded by

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

(eBook PDF) Introduction to Java Programming and

Data Structures, Comprehensive Version, 11th


Global Edition download

https://ebookluna.com/product/ebook-pdf-introduction-to-java-
programming-and-data-structures-comprehensive-version-11th-
global-edition/

Download more ebook from https://ebookluna.com


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

(eBook PDF) Introduction to JAVA Programming and Data Structures


Comprehensive Version 11

https://ebookluna.com/product/ebook-pdf-introduction-to-java-programming-
and-data-structures-comprehensive-version-11/

(eBook PDF) Introduction to Java Programming, Brief Version, Global Edition


11th Edition

https://ebookluna.com/product/ebook-pdf-introduction-to-java-programming-
brief-version-global-edition-11th-edition/

Introduction to Java Programming, Comprehensive Version 10th edition- eBook


PDF

https://ebookluna.com/download/introduction-to-java-programming-
comprehensive-version-ebook-pdf/

(eBook PDF) Java Foundations: Introduction to Program Design and Data


Structures 5th Edition

https://ebookluna.com/product/ebook-pdf-java-foundations-introduction-to-
program-design-and-data-structures-5th-edition/
(eBook PDF) Data Structures and Abstractions with Java 4th Global Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-abstractions-
with-java-4th-global-edition/

(eBook PDF) Data Structures and Abstractions with Java 4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-abstractions-
with-java-4th-edition/

Data Structures and Abstractions with Java 5th Edition (eBook PDF)

https://ebookluna.com/product/data-structures-and-abstractions-with-
java-5th-edition-ebook-pdf/

(eBook PDF) Data Structures and Other Objects Using Java 4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-other-objects-
using-java-4th-edition/

(eBook PDF) Data Structures and Problem Solving Using Java 4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-problem-
solving-using-java-4th-edition/
6 Preface

Part I: Fundamentals of Part II: Object-Oriented Part III: GUI Programming Part IV: Data Structures and Part V: Advanced Java
Programming Programming Algorithms Ch 16 Programming
Chapter 1 Introduction to Chapter 9 Objects and Classes Chapter 14 JavaFX Basics Ch 7 Chapter 18 Recursion Chapter 32 Multithreading and
Computers, Programs, and Parallel Programming
Java
Chapter 10 Thinking in Objects Chapter 15 Event-Driven Ch 13 Chapter 19 Generics
Programming and Chapter 33 Networking
Chapter 2 Elementary Animations
Chapter 11 Inheritance and Chapter 20 Lists, Stacks, Queues,
Programming
Polymorphism and Priority Queues Chapter 34 Java Database
Chapter 16 JavaFX Controls Programming
Chapter 3 Selections and Multimedia
Chapter 12 Exception Chapter 21 Sets and Maps
Handling and Text I/O Chapter 35 Advanced Database
Chapter 4 Mathematical Chapter 31 Advanced JavaFX Programming
Chapter 22 Developping
Functions, Characters, Chapter 13 Abstract Classes and FXML Efficient Algorithms
and Strings and Interfaces Chapter 36 Internationalization
Chapter 23 Sorting
Chapter 5 Loops Chapter 17 Binary I/O Chapter 37 Servlets
Chapter 24 Implementing Lists,
Chapter 6 Methods Stacks, Queues, and Priority Chapter 38 JavaServer Pages
Queues

Chapter 7 Single-Dimensional Chapter 39 JavaServer Faces


Arrays Chapter 25 Binary Search Trees
Chapter 40 RMI
Note: Chapters 1–18 are in the
Chapter 8 Multidimensional Chapter 26 AVL Trees
brief version of this book.
Arrays Chapter 41 Web Services
Note: Chapters 1–30 are in the Chapter 27 Hashing
comprehensive version.

Note: Chapters 31–44 are bonus Chapter 28 Graphs and


chapters available from the Applications
Companion Website.

Chapter 29 Weighted Graphs


and Applications

Chapter 30 Aggregate Operations


and Collection Streams

Chapter 42 2-4 Trees and B-


Trees

Chapter 43 Red-Black Trees Ch 9 Chapter 44 Testing Using JUnit


Preface  7

Organization of the Book


The chapters can be grouped into five parts that, taken together, form a comprehensive introduc-
tion to Java programming, data structures and algorithms, and database and Web programming.
Because knowledge is cumulative, the early chapters provide the conceptual basis for under-
standing programming and guide students through simple examples and exercises; subsequent
chapters progressively present Java programming in detail, culminating with the development
of comprehensive Java applications. The appendixes contain a mixed bag of topics, including an
introduction to number systems, bitwise operations, regular expressions, and enumerated types.

Part I: Fundamentals of Programming (Chapters 1–8)


The first part of the book is a stepping stone, preparing you to embark on the journey of learning
Java. You will begin to learn about Java (Chapter 1) and fundamental programming t­echniques
with primitive data types, variables, constants, assignments, expressions, and operators (­Chapter 2),
selection statements (Chapter 3), mathematical functions, characters, and strings (Chapter 4), loops
(Chapter 5), methods (Chapter 6), and arrays (Chapters 7–8). After ­Chapter 7, you can jump to
Chapter 18 to learn how to write recursive methods for solving inherently recursive problems.

Part II: Object-Oriented Programming (Chapters 9–13, and 17)


This part introduces object-oriented programming. Java is an object-oriented programming
language that uses abstraction, encapsulation, inheritance, and polymorphism to provide
great flexibility, modularity, and reusability in developing software. You will learn program-
ming with objects and classes (Chapters 9–10), class inheritance (Chapter 11), polymorphism
(­Chapter 11), exception handling (Chapter 12), abstract classes (Chapter 13), and interfaces
(Chapter 13). Text I/O is introduced in Chapter 12 and binary I/O is discussed in Chapter 17.

Part III: GUI Programming (Chapters 14–16 and Bonus Chapter 31)
JavaFX is a new framework for developing Java GUI programs. It is not only useful for
developing GUI programs, but also an excellent pedagogical tool for learning object-oriented
programming. This part introduces Java GUI programming using JavaFX in Chapters 14–16.
Major topics include GUI basics (Chapter 14), container panes (Chapter 14), drawing shapes
(Chapter 14), event-driven programming (Chapter 15), animations (Chapter 15), and GUI
­controls (Chapter 16), and playing audio and video (Chapter 16). You will learn the a­ rchitecture
of JavaFX GUI programming and use the controls, shapes, panes, image, and video to develop
useful applications. Chapter 31 covers advanced features in JavaFX.

Part IV: Data Structures and Algorithms (Chapters 18–30 and Bonus Chapters 42–43)
This part covers the main subjects in a typical data structures and algorithms course. Chapter 18
introduces recursion to write methods for solving inherently recursive problems. Chapter 19 presents
how generics can improve software reliability. Chapters 20 and 21 introduce the Java Collection
Framework, which defines a set of useful API for data structures. Chapter 22 discusses measur-
ing algorithm efficiency in order to choose an appropriate algorithm for applications. Chapter 23
describes classic sorting algorithms. You will learn how to implement several classic data struc-
tures lists, queues, and priority queues in Chapter 24. Chapters 25 and 26 introduce binary search
trees and AVL trees. Chapter 27 presents hashing and implementing maps and sets using hashing.
Chapters 28 and 29 introduce graph applications. Chapter 30 introduces aggregate operations for
collection streams. The 2-4 trees, B-trees, and red-black trees are covered in Bonus Chapters 42–43.

Part V: Advanced Java Programming (Chapters 32-41, 44)


This part of the book is devoted to advanced Java programming. Chapter 32 treats the use of
multithreading to make programs more responsive and interactive and introduces parallel pro-
gramming. Chapter 33 discusses how to write programs that talk with each other from different
8 Preface
hosts over the Internet. Chapter 34 introduces the use of Java to develop database projects.
Chapter 35 delves into advanced Java database programming. Chapter 36 covers the use of
internationalization support to develop projects for international audiences. Chapters 37 and
38 introduce how to use Java servlets and JavaServer Pages to generate dynamic content from
Web servers. Chapter 39 introduces modern Web application development using JavaServer
Faces. Chapter 40 introduces remote method invocation and Chapter 41 discusses Web ser-
vices. Chapter 44 introduces testing Java programs using JUnit.

Appendixes
This part of the book covers a mixed bag of topics. Appendix A lists Java keywords. ­Appendix B
gives tables of ASCII characters and their associated codes in decimal and in hex. Appen-
dix C shows the operator precedence. Appendix D summarizes Java modifiers and their usage.
Appendix E discusses special floating-point values. Appendix F introduces number systems and
conversions among binary, decimal, and hex numbers. Finally, Appendix G introduces bitwise
operations. Appendix H introduces regular expressions. Appendix I covers enumerated types.

Java Development Tools


You can use a text editor, such as the Windows Notepad or WordPad, to create Java programs
and to compile and run the programs from the command window. You can also use a Java
development tool, such as NetBeans or Eclipse. These tools support an integrated develop-
ment environment (IDE) for developing Java programs quickly. Editing, compiling, building,
executing, and debugging programs are integrated in one graphical user interface. Using these
tools effectively can greatly increase your programming productivity. NetBeans and Eclipse
IDE tutorials are easy to use if you follow the tutorials. Tutorials on NetBeans and Eclipse can be found in
the supplements on the Companion Website www.pearsonglobaleditions.com/Liang.

Student Resources
The Companion Website (www.pearsonglobaleditions.com/Liang) contains the following
resources:
■■ Answers to CheckPoint questions
■■ Solutions to majority of even-numbered programming exercises
■■ Source code for the examples in the book
■■ Interactive quiz (organized by sections for each chapter)
■■ Supplements
■■ Debugging tips
■■ Video notes
■■ Algorithm animations

Supplements
The text covers the essential subjects. The supplements extend the text to introduce additional
topics that might be of interest to readers. The supplements are available from the Companion
Website.
Preface  9

Instructor Resources
The Companion Website, accessible from www.pearsonglobaleditions.com/Liang, contains the
following resources:
■■ Microsoft PowerPoint slides with interactive buttons to view full-color, syntax-highlighted
source code and to run programs without leaving the slides.
■■ Solutions to a majority of odd-numbered programming exercises.
■■ More than 200 additional programming exercises and 300 quizzes organized by ­chapters.
These exercises and quizzes are available only to the instructors. Solutions to these
­exercises and quizzes are provided.
■■ Web-based quiz generator. (Instructors can choose chapters to generate quizzes from a
large database of more than two thousand questions.)
■■ Sample exams. Most exams have four parts:
■■ Multiple-choice questions or short-answer questions
■■ Correct programming errors
■■ Trace programs
■■ Write programs
■■ Sample exams with ABET course assessment.
■■ Projects. In general, each project gives a description and asks students to analyze, design,
and implement the project.
Some readers have requested the materials from the Instructor Resource Center. Please
understand that these are for instructors only. Such requests will not be answered.

Online Practice and Assessment


with MyProgrammingLab
MyProgrammingLab helps students fully grasp the logic, semantics, and syntax of program-
ming. Through practice exercises and immediate, personalized feedback, MyProgrammingLab
improves the programming competence of beginning students who often struggle with the
basic concepts and paradigms of popular high-level programming languages.
A self-study and homework tool, a MyProgrammingLab course consists of hundreds of small
practice problems organized around the structure of this textbook. For students, the system auto-
matically detects errors in the logic and syntax of their code submissions and offers targeted hints
that enable students to figure out what went wrong—and why. For instructors, a comprehensive
gradebook tracks correct and incorrect answers and stores the code inputted by students for review.
MyProgrammingLab is offered to users of this book in partnership with Turing’s Craft, the
makers of the CodeLab interactive programming exercise system. For a full demonstration,
to see feedback from instructors and students, or to get started using MyProgrammingLab in
your course, visit www.myprogramminglab.com.

Video Notes
We are excited about the new Video Notes feature that is found in this new edition. These VideoNote

videos provide additional help by presenting examples of key topics and showing how
to solve problems completely from design through coding. Video Notes are available from
www.pearsonglobaleditions.com/Liang.
10 Preface

Algorithm Animations
Animation We have provided numerous animations for algorithms. These are valuable pedagogical tools
to demonstrate how algorithms work. Algorithm animations can be accessed from the Com-
panion Website.

Acknowledgments
I would like to thank Armstrong State University for enabling me to teach what I write and for
supporting me in writing what I teach. Teaching is the source of inspiration for continuing to
improve the book. I am grateful to the instructors and students who have offered comments,
suggestions, corrections, and praise. My special thanks go to Stefan Andrei of Lamar Univer-
sity and William Bahn of University of Colorado Colorado Springs for their help to improve
the data structures part of this book.
This book has been greatly enhanced thanks to outstanding reviews for this and previous edi-
tions. The reviewers are: Elizabeth Adams (James Madison University), Syed Ahmed (North
­Georgia College and State University), Omar Aldawud (Illinois Institute of Technology), Ste-
fan Andrei (Lamar University), Yang Ang (University of Wollongong, Australia), Kevin Bierre
(Rochester Institute of Technology), Aaron Braskin (Mira Costa High School), David Champion
(DeVry Institute), James Chegwidden (Tarrant County College), Anup Dargar (University of North
Dakota), Daryl Detrick (Warren Hills Regional High School), Charles Dierbach (Towson Univer-
sity), Frank Ducrest (University of Louisiana at Lafayette), Erica Eddy (University of Wisconsin at
Parkside), Summer Ehresman (Center Grove High School), Deena Engel (New York University),
Henry A. Etlinger (Rochester Institute of Technology), James Ten Eyck (Marist College), Myers
Foreman (Lamar University), Olac Fuentes (University of Texas at El Paso), Edward F. Gehringer
(North Carolina State University), Harold Grossman (Clemson University), Barbara Guillot (Loui-
siana State University), Stuart Hansen (University of Wisconsin, Parkside), Dan Harvey (Southern
Oregon University), Ron Hofman (Red River College, Canada), Stephen Hughes (Roanoke Col-
lege), Vladan Jovanovic (Georgia Southern University), Deborah Kabura Kariuki (Stony Point
High School), Edwin Kay (Lehigh University), Larry King (University of Texas at Dallas), Nana
Kofi (Langara College, Canada), George Koutsogiannakis (Illinois Institute of Technology), Roger
Kraft (Purdue University at Calumet), Norman Krumpe (Miami University), Hong Lin (DeVry
Institute), Dan Lipsa (Armstrong State University), James Madison (Rensselaer Polytechnic Insti-
tute), Frank Malinowski (Darton College), Tim Margush (University of Akron), Debbie Masada
(Sun Microsystems), Blayne Mayfield (Oklahoma State University), John McGrath (J.P. McGrath
Consulting), Hugh McGuire (Grand Valley State), Shyamal Mitra (University of Texas at Austin),
Michel Mitri (James Madison University), Kenrick Mock (University of Alaska Anchorage), Frank
Murgolo (California State University, Long Beach), Jun Ni (University of Iowa), Benjamin N ­ ystuen
(University of Colorado at Colorado Springs), Maureen Opkins (CA State University, Long Beach),
Gavin Osborne (University of Saskatchewan), Kevin Parker (Idaho State University), Dale Par-
son (Kutztown University), Mark Pendergast (Florida Gulf Coast University), Richard Povinelli
(Marquette University), Roger Priebe (University of Texas at Austin), Mary Ann Pumphrey (De
Anza Junior College), Pat Roth (Southern Polytechnic State University), Amr Sabry (Indiana Uni-
versity), Ben Setzer (Kennesaw State University), Carolyn Schauble (Colorado State University),
David Scuse (University of Manitoba), Ashraf Shirani (San Jose State University), Daniel Spiegel
(Kutztown University), Joslyn A. Smith (Florida Atlantic University), Lixin Tao (Pace University),
Ronald F. Taylor (Wright State University), Russ Tront (Simon Fraser University), Deborah ­Trytten
(University of Oklahoma), Michael Verdicchio (Citadel), Kent Vidrine (George Washington Uni-
versity), and Bahram Zartoshty (California State University at Northridge).
It is a great pleasure, honor, and privilege to work with Pearson. I would like to thank Tracy
Johnson and her colleagues Marcia Horton, Demetrius Hall, Yvonne Vannatta, Kristy Alaura,
Carole Snyder, Scott Disanno, Bob Engelhardt, Shylaja Gattupalli, and their colleagues for
organizing, producing, and promoting this project.
As always, I am indebted to my wife, Samantha, for her love, support, and encouragement.
Preface  11

Acknowledgments for the Global Edition


Pearson would like to thank and acknowledge Yvan Maillot (Univresite Haute-Alsace) and
Steven Yuwono (National ­University of Singapore) for contributing to this Global Edition,
and Arif Ahmed (National Institute of Technology, ­Silchar), Annette Bieniusa (University of
Kaiserslautern), Shaligram Prajapat (Devi Ahilya Vishwavidyalaya, Indore), and Ram Gopal
Raj (University of Malaya) for reviewing this Global Edition.
CONTENTS
Chapter 1 I ntroduction to Computers,
­Programs, and Java™ 23
1.1 Introduction 24
1.2 What Is a Computer? 24
1.3 Programming Languages 29
1.4 Operating Systems 31
1.5 Java, the World Wide Web, and Beyond 32
1.6 The Java Language Specification, API, JDK,
JRE, and IDE 33
1.7 A Simple Java Program 34
1.8 Creating, Compiling, and Executing a Java Program 37
1.9 Programming Style and Documentation 40
1.10 Programming Errors 42
1.11 Developing Java Programs Using NetBeans 45
1.12 Developing Java Programs Using Eclipse 47

Chapter 2 Elementary Programming 55


2.1 Introduction 56
2.2 Writing a Simple Program 56
2.3 Reading Input from the Console 59
2.4 Identifiers 62
2.5 Variables 62
2.6 Assignment Statements and Assignment Expressions 64
2.7 Named Constants 65
2.8 Naming Conventions 66
2.9 Numeric Data Types and Operations 67
2.10 Numeric Literals 70
2.11 Evaluating Expressions and Operator Precedence 72
2.12 Case Study: Displaying the Current Time 74
2.13 Augmented Assignment Operators 76
2.14 Increment and Decrement Operators 77
2.15 Numeric Type Conversions 79
2.16 Software Development Process 81
2.17 Case Study: Counting Monetary Units 85
2.18 Common Errors and Pitfalls 87

Chapter 3 Selections 97
3.1 Introduction 98
3.2 boolean Data Type 98
3.3 if Statements 100
3.4 Two-Way if-else Statements 102
3.5 Nested if and Multi-Way if-else Statements 103
3.6 Common Errors and Pitfalls 105
3.7 Generating Random Numbers 109
3.8 Case Study: Computing Body Mass Index 111
3.9 Case Study: Computing Taxes 112
3.10 Logical Operators 115
3.11 Case Study: Determining Leap Year 119
3.12 Case Study: Lottery 120
3.13 switch Statements 122
12
Contents  13
3.14 Conditional Operators 125
3.15 Operator Precedence and Associativity 126
3.16 Debugging 128

Chapter 4 Mathematical Functions,


Characters, and Strings 141
4.1 Introduction 142
4.2 Common Mathematical Functions 142
4.3 Character Data Type and Operations 147
4.4 The String Type 152
4.5 Case Studies 161
4.6 Formatting Console Output 167

Chapter 5 Loops 181


5.1 Introduction 182
5.2 The while Loop 182
5.3 Case Study: Guessing Numbers 185
5.4 Loop Design Strategies 188
5.5 Controlling a Loop with User Confirmation or a Sentinel Value 190
5.6 The do-while Loop 192
5.7 The for Loop 195
5.8 Which Loop to Use? 198
5.9 Nested Loops 200
5.10 Minimizing Numeric Errors 202
5.11 Case Studies 204
5.12 Keywords break and continue 208
5.13 Case Study: Checking Palindromes 211
5.14 Case Study: Displaying Prime Numbers 213

Chapter 6 Methods 227


6.1 Introduction 228
6.2 Defining a Method 228
6.3 Calling a Method 230
6.4 void vs. Value-Returning Methods 233
6.5 Passing Parameters by Values 236
6.6 Modularizing Code 239
6.7 Case Study: Converting Hexadecimals to Decimals 241
6.8 Overloading Methods 243
6.9 The Scope of Variables 246
6.10 Case Study: Generating Random Characters 247
6.11 Method Abstraction and Stepwise Refinement 249

Chapter 7 Single-Dimensional Arrays 269


7.1 Introduction 270
7.2 Array Basics 270
7.3 Case Study: Analyzing Numbers 277
7.4 Case Study: Deck of Cards 278
7.5 Copying Arrays 280
7.6 Passing Arrays to Methods 281
7.7 Returning an Array from a Method 284
7.8 Case Study: Counting the Occurrences of Each Letter 285
7.9 Variable-Length Argument Lists 288
7.10 Searching Arrays 289
7.11 Sorting Arrays 293
14 Contents
7.12 The Arrays Class 294
7.13 Command-Line Arguments 296

Chapter 8 Multidimensional Arrays 311


8.1 Introduction 312
8.2 Two-Dimensional Array Basics 312
8.3 Processing Two-Dimensional Arrays 315
8.4 Passing Two-Dimensional Arrays to Methods 317
8.5 Case Study: Grading a Multiple-Choice Test 318
8.6 Case Study: Finding the Closest Pair 320
8.7 Case Study: Sudoku 322
8.8 Multidimensional Arrays 325

Chapter 9 Objects and Classes 345


9.1 Introduction 346
9.2 Defining Classes for Objects 346
9.3 Example: Defining Classes and Creating Objects 348
9.4 Constructing Objects Using Constructors 353
9.5 Accessing Objects via Reference Variables 354
9.6 Using Classes from the Java Library 358
9.7 Static Variables, Constants, and Methods 361
9.8 Visibility Modifiers 366
9.9 Data Field Encapsulation 368
9.10 Passing Objects to Methods 371
9.11 Array of Objects 375
9.12 Immutable Objects and Classes 377
9.13 The Scope of Variables 379
9.14 The this Reference 380

Chapter 10 Object-Oriented Thinking 389


10.1 Introduction 390
10.2 Class Abstraction and Encapsulation 390
10.3 Thinking in Objects 394
10.4 Class Relationships 397
10.5 Case Study: Designing the Course Class 400
10.6 Case Study: Designing a Class for Stacks 402
10.7 Processing Primitive Data Type Values as Objects 404
10.8 Automatic Conversion between Primitive Types
and Wrapper Class Types 407
10.9 The BigInteger and BigDecimal Classes 408
10.10 The String Class 410
10.11 The StringBuilder and StringBuffer Classes 416

Chapter 11 Inheritance and


Polymorphism 433
11.1 Introduction 434
11.2 Superclasses and Subclasses 434
11.3 Using the super Keyword 440
11.4 Overriding Methods 443
11.5 Overriding vs. Overloading 444
11.6 The Object Class and Its toString() Method 446
11.7 Polymorphism 447
11.8 Dynamic Binding 447
11.9 Casting Objects and the instanceof Operator 451
11.10 The Object’s equals Method 455
Contents  15
11.11 The ArrayList Class 456
11.12 Useful Methods for Lists 462
11.13 Case Study: A Custom Stack Class 463
11.14 The protected Data and Methods 464
11.15 Preventing Extending and Overriding 467

Chapter 12 Exception Handling


and Text I/O 475
12.1 Introduction 476
12.2 Exception-Handling Overview 476
12.3 Exception Types 481
12.4 More on Exception Handling 484
12.5 The finally Clause 492
12.6 When to Use Exceptions 493
12.7 Rethrowing Exceptions 494
12.8 Chained Exceptions 495
12.9 Defining Custom Exception Classes 496
12.10 The File Class 499
12.11 File Input and Output 502
12.12 Reading Data from the Web 508
12.13 Case Study: Web Crawler 510

Chapter 13 Abstract Classes and Interfaces 521


13.1 Introduction 522
13.2 Abstract Classes 522
13.3 Case Study: the Abstract Number Class 527
13.4 Case Study: Calendar and GregorianCalendar 529
13.5 Interfaces 532
13.6 The Comparable Interface 535
13.7 The Cloneable Interface 540
13.8 Interfaces vs. Abstract Classes 545
13.9 Case Study: The Rational Class 548
13.10 Class-Design Guidelines 553

Chapter 14 JavaFX Basics 563


14.1 Introduction 564
14.2 JavaFX vs Swing and AWT 564
14.3 The Basic Structure of a JavaFX Program 564
14.4 Panes, Groups, UI Controls, and Shapes 567
14.5 Property Binding 570
14.6 Common Properties and Methods for Nodes 573
14.7 The Color Class 575
14.8 The Font Class 576
14.9 The Image and ImageView Classes 578
14.10 Layout Panes and Groups 580
14.11 Shapes 589
14.12 Case Study: The ClockPane Class 602

Chapter 15 Event-Driven Programming


and Animations 615
15.1 Introduction 616
15.2 Events and Event Sources 618
15.3 Registering Handlers and Handling Events 619
15.4 Inner Classes 623
15.5 Anonymous Inner Class Handlers 624
16 Contents
15.6 Simplifying Event Handling Using Lambda Expressions 627
15.7 Case Study: Loan Calculator 631
15.8 Mouse Events 633
15.9 Key Events 635
15.10 Listeners for Observable Objects 638
15.11 Animation 640
15.12 Case Study: Bouncing Ball 648
15.13 Case Study: US Map 652

Chapter 16 JavaFX UI Controls


and Multimedia 665
16.1 Introduction 666
16.2 Labeled and Label 666
16.3 Button 668
16.4 CheckBox 670
16.5 RadioButton 673
16.6 TextField 676
16.7 TextArea 677
16.8 ComboBox 681
16.9 ListView 684
16.10 ScrollBar 687
16.11 Slider 690
16.12 Case Study: Developing a Tic-Tac-Toe Game 693
16.13 Video and Audio 698
16.14 Case Study: National Flags and Anthems 701

Chapter 17 Binary I/O 713


17.1 Introduction 714
17.2 How Is Text I/O Handled in Java? 714
17.3 Text I/O vs. Binary I/O 715
17.4 Binary I/O Classes 716
17.5 Case Study: Copying Files 726
17.6 Object I/O 728
17.7 Random-Access Files 733

Chapter 18 Recursion 741


18.1 Introduction 742
18.2 Case Study: Computing Factorials 742
18.3 Case Study: Computing Fibonacci
Numbers 745
18.4 Problem Solving Using Recursion 748
18.5 Recursive Helper Methods 750
18.6 Case Study: Finding the Directory Size 753
18.7 Case Study: Tower of Hanoi 755
18.8 Case Study: Fractals 758
18.9 Recursion vs. Iteration 762
18.10 Tail Recursion 762

Chapter 19 Generics 773


19.1 Introduction 774
19.2 Motivations and Benefits 774
19.3 Defining Generic Classes and Interfaces 776
19.4 Generic Methods 778
19.5 Case Study: Sorting an Array of Objects 780
Contents  17
19.6 Raw Types and Backward Compatibility 782
19.7 Wildcard Generic Types 783
19.8 Erasure and Restrictions on Generics 786
19.9 Case Study: Generic Matrix Class 788

Chapter 20 L
 ists, Stacks, Queues, and
Priority Queues 797
20.1 Introduction 798
20.2 Collections 798
20.3 Iterators 802
20.4 Using the forEach Method 803
20.5 Lists 804
20.6 The Comparator Interface 809
20.7 Static Methods for Lists and Collections 813
20.8 Case Study: Bouncing Balls 816
20.9 Vector and Stack Classes 820
20.10 Queues and Priority Queues 821
20.11 Case Study: Evaluating Expressions 825

Chapter 21 Sets and Maps 837


21.1 Introduction 838
21.2 Sets 838
21.3 Comparing the Performance of Sets and Lists 846
21.4 Case Study: Counting Keywords 849
21.5 Maps 850
21.6 Case Study: Occurrences of Words 855
21.7 Singleton and Unmodifiable Collections and Maps 857

Chapter 22 Developing Efficient


Algorithms 861
22.1 Introduction 862
22.2 Measuring Algorithm Efficiency Using Big O Notation 862
22.3 Examples: Determining Big O 864
22.4 Analyzing Algorithm Time Complexity 868
22.5 Finding Fibonacci Numbers Using Dynamic
Programming 871
22.6 Finding Greatest Common Divisors Using Euclid’s
Algorithm 873
22.7 Efficient Algorithms for Finding Prime Numbers 877
22.8 Finding the Closest Pair of Points Using
Divide-and-Conquer 883
22.9 Solving the Eight Queens Problem Using Backtracking 886
22.10 Computational Geometry: Finding a Convex Hull 889

Chapter 23 Sorting 903


23.1 Introduction 904
23.2 Insertion Sort 904
23.3 Bubble Sort 906
23.4 Merge Sort 909
23.5 Quick Sort 912
23.6 Heap Sort 916
23.7 Bucket and Radix Sorts 923
23.8 External Sort 925
18 Contents

Chapter 24 I mplementing Lists, Stacks,


Queues, and Priority Queues 939
24.1 Introduction 940
24.2 Common Operations for Lists 940
24.3 Array Lists 944
24.4 Linked Lists 951
24.5 Stacks and Queues 965
24.6 Priority Queues 969

Chapter 25 Binary Search Trees 975


25.1 Introduction 976
25.2 Binary Search Trees 976
25.3 Deleting Elements from a BST 989
25.4 Tree Visualization and MVC 995
25.5 Iterators 998
25.6 Case Study: Data Compression 1000

Chapter 26 AVL Trees 1011


26.1 Introduction 1012
26.2 Rebalancing Trees 1012
26.3 Designing Classes for AVL Trees 1015
26.4 Overriding the insert Method 1016
26.5 Implementing Rotations 1017
26.6 Implementing the delete Method 1018
26.7 The AVLTree Class 1018
26.8 Testing the AVLTree Class 1024
26.9 AVL Tree Time Complexity Analysis 1027

Chapter 27 Hashing 1031


27.1 Introduction 1032
27.2 What Is Hashing? 1032
27.3 Hash Functions and Hash Codes 1033
27.4 Handling Collisions Using Open Addressing 1035
27.5 Handling Collisions Using Separate Chaining 1039
27.6 Load Factor and Rehashing 1039
27.7 Implementing a Map Using Hashing 1041
27.8 Implementing Set Using Hashing 1050

Chapter 28 Graphs and Applications 1061


28.1 Introduction 1062
28.2 Basic Graph Terminologies 1063
28.3 Representing Graphs 1064
28.4 Modeling Graphs 1070
28.5 Graph Visualization 1080
28.6 Graph Traversals 1083
28.7 Depth-First Search (DFS) 1084
28.8 Case Study: The Connected Circles Problem 1088
28.9 Breadth-First Search (BFS) 1090
28.10 Case Study: The Nine Tails Problem 1093
Contents  19

Chapter 29 W
 eighted Graphs and
Applications 1107
29.1 Introduction 1108
29.2 Representing Weighted Graphs 1109
29.3 The WeightedGraph Class 1111
29.4 Minimum Spanning Trees 1119
29.5 Finding Shortest Paths 1125
29.6 Case Study: The Weighted Nine Tails Problem 1134

Chapter 30 
Aggregate Operations
for Collection Streams 1145
30.1 Introduction 1146
30.2 Stream Pipelines 1146
30.3 IntStream, LongStream, and DoubleStream 1152
30.4 Parallel Streams 1155
30.5 Stream Reduction Using the reduce Method 1157
30.6 Stream Reduction Using the collect Method 1160
30.7 Grouping Elements Using the groupingby Collector 1163
30.8 Case Studies 1166

Chapter 31–44 are available from the Companion Website at


www.pearsonglobaleditions.com/Liang

Chapter 31 Advanced JavaFX and FXML


Chapter 32 Multithreading and Parallel
Programming
Chapter 33 Networking
Chapter 34 Java Database Programming
Chapter 35 Advanced Java Database Programming
Chapter 36 Internationalization
Chapter 37 Servlets
Chapter 38 JavaServer Pages
Chapter 39 JavaServer Faces
Chapter 40 Remote Method Invocation
Chapter 41 Web Services
Chapter 42 2-4 Trees and B-Trees
Chapter 43 Red-Black Trees
Chapter 44 Testing Using JUnit
Discovering Diverse Content Through
Random Scribd Documents
frightened, and asked young Antonio, in serious good faith, if he did
not believe the juggler had made a league with the devil. A few
nights afterward, at midnight, a terrible noise was heard in the
gambler's room. He was found in convulsions, foaming at the mouth,
and crying, "Oh, father! father! I have got the devil inside of me!
Take him away!"
The priest dragged him into the chapel, showered him with holy
water, and exorcised the devil, first making the gambler promise to
leave off his gambling forever. All the rest of the night the rescued
sinner spent in the chapel, praying and weeping. In the morning he
announced his intention of becoming a priest, and began his studies
at once. These he faithfully pursued for a year, leading all the while
a life of great devotion. At the end of that time preparations were
made for his ordination at San José. The day was set, the hour
came: he was in the sacristy, had put on the sacred vestments, and
was just going toward the church door, when he fell to the floor,
dead. Soon after this the juggler was banished from the county,
trouble and disaster having everywhere followed on his presence.
On the first breaking out of hostilities between California and the
United States, Don Antonio took command of a company of Los
Angeles volunteers to repel the intruders. By this time he had
attained a prominent position in the affairs of the pueblo; had been
alcalde and, under Governor Michelorena, inspector of public works.
It was like the fighting of children,—the impetuous attempts that
heterogeneous little bands of Californians here and there made to
hold their country. They were plucky from first to last; for they were
everywhere at a disadvantage, and fought on, quite in the dark as to
what Mexico meant to do about them,—whether she might not any
morning deliver them over to the enemy. Of all Don Antonio's
graphic narratives of the olden time, none is more interesting than
those which describe his adventures during the days of this contest.
On one of the first approaches made by the Americans to Los
Angeles, he went out with his little haphazard company of men and
boys to meet them. He had but one cannon, a small one, tied by
ropes on a cart axle. He had but one small keg of powder which was
good for anything; all the rest was bad, would merely go off "pouf,
pouf," the señora said, and the ball would pop down near the mouth
of the cannon. With this bad powder he fired his first shots. The
Americans laughed; this is child's play, they said, and pushed on
closer. Then came a good shot, with the good powder, tearing into
their ranks and knocking them right and left; another, and another.
"Then the Americans began to think, these are no pouf balls; and
when a few more were killed, they ran away and left their flag
behind them. And if they had only known it, the Californians had
only one more charge left of the good powder, and the next minute
it would have been the Californians that would have had to run away
themselves," merrily laughed the señora as she told the tale.
This captured flag, with important papers, was intrusted to Don
Antonio to carry to the Mexican headquarters at Sonora. He set off
with an escort of soldiers, his horse decked with silver trappings; his
sword, pistols, all of the finest: a proud beginning of a journey
destined to end in a different fashion. It was in winter time; cold
rains were falling. By night he was drenched to the skin, and
stopped at a friendly Indian's tent to change his clothes. Hardly had
he got them off when the sound of horses' hoofs was heard. The
Indian flung himself down, put his ear to the ground, and exclaimed,
"Americanos! Americanos!" Almost in the same second they were at
the tent's door. As they halted, Don Antonio, clad only in his drawers
and stockings, crawled out at the back of the tent, and creeping on
all fours reached a tree up which he climbed, and sat safe hidden in
the darkness among its branches listening, while his pursuers cross-
questioned the Indian, and at last rode away with his horse. Luckily,
he had carried into the tent the precious papers and the captured
flag: these he intrusted to an Indian to take to Sonora, it being
evidently of no use for him to try to cross the country thus closely
pursued by his enemies.
All night he lay hidden; the next day he walked twelve miles across
the mountains to an Indian village where he hoped to get a horse. It
was dark when he reached it. Cautiously he opened the door of the
hut of one whom he knew well. The Indian was preparing poisoned
arrows: fixing one on the string and aiming at the door, he called
out, angrily, "Who is there?"—"It is I, Antonio."—"Don't make a
sound," whispered the Indian, throwing down his arrow, springing to
the door, coming out and closing it softly. He then proceeded to tell
him that the Americans had offered a reward for his head, and that
some of the Indians in the rancheria were ready to betray or kill him.
While they were yet talking, again came the sound of the Americans'
horses' hoofs galloping in the distance. This time there seemed no
escape. Suddenly Don Antonio, throwing himself on his stomach,
wriggled into a cactus patch near by. Only one who has seen
California cactus thickets can realize the desperateness of this act.
But it succeeded. The Indian threw over the cactus plants an old
blanket and some refuse stalks and reeds; and there once more,
within hearing of all his baffled pursuers said, the hunted man lay,
safe, thanks to Indian friendship. The crafty Indian assented to all
the Americans proposed, said that Don Antonio would be sure to be
caught in a few days, advised them to search in a certain rancheria
which he described, a few miles off, and in an opposite direction
from the way in which he intended to guide Don Antonio. As soon as
the Americans had gone, he bound up Antonio's feet in strips of
rawhide, gave him a blanket and an old tattered hat, the best his
stores afforded, and then led him by a long and difficult trail to a
spot high up in the mountains where the old women of the band
were gathering acorns. By the time they reached this place, blood
was trickling from Antonio's feet and legs, and he was well-nigh
fainting with fatigue and excitement. Tears rolled down the old
women's cheeks when they saw him. Some of them had been
servants in his father's house, and loved him. One brought gruel;
another bathed his feet; others ran in search of healing leaves of
different sorts. Bruising these in a stone mortar, they rubbed him
from head to foot with the wet fibre. All his pain and weariness
vanished as by magic. His wounds healed, and in a day he was
ready to set off for home. There was but one pony in the old
women's camp. This was old, vicious, blind of one eye, and with one
ear cropped short; but it looked to Don Antonio far more beautiful
than the gay steed on which he had ridden away from Los Angeles
three days before. There was one pair of ragged shoes of enormous
size among the old women's possessions. These were strapped on
his feet by leathern thongs, and a bit of old sheepskin was tied
around the pony's body. Thus accoutred and mounted, shivering in
his drawers under his single blanket, the captain and flag-bearer
turned his face homeward. At the first friend's house he reached he
stopped and begged for food. Some dried meat was given to him,
and a stool on the porch offered to him. It was the house of a dear
friend, and the friend's sister was his sweetheart. As he sat there
eating his meat, the women eyed him curiously. One said to the
other, "How much he looks like Antonio!" At last the sweetheart,
coming nearer, asked him if he were "any relation of Don Antonio."
"No," he said. Just at that moment his friend rode up, gave one
glance at the pitiful beggar sitting on his porch, shouted his name,
dashed toward him, and seized him in his arms. Then was a great
laughing and half-weeping, for it had been rumored that he had
been taken prisoner by the Americans.
From this friend he received a welcome gift of a pair of trousers,
many inches too short for his legs. At the next house his friend was
as much too tall, and his second pair of gift trousers had to be rolled
up in thick folds around his ankles.
Finally he reached Los Angeles in safety. Halting in a grove outside
the town, he waited till twilight before entering. Having disguised
himself in the rags which he had worn from the Indian village, he
rode boldly up to the porch of his father's house, and in an impudent
tone called for brandy. The terrified women began to scream; but his
youngest sister, fixing one piercing glance on his face, laughed out
gladly, and cried, "You can't fool me; you are Antonio."
Sitting in the little corner room, looking out through the open door
on the gay garden and breathing its spring air, gay even in
midwinter, and as spicy then as the gardens of other lands are in
June, I spent many an afternoon listening to such tales as this.
Sunset always came long before its time, it seemed, on these days.
Occasionally, at the last moment, Don Antonio would take up his
guitar, and, in a voice still sympathetic and full of melody, sing an old
Spanish love-song, brought to his mind by thus living over the
events of his youth. Never, however, in his most ardent youth, could
his eyes have gazed on his fairest sweetheart's face with a look of
greater devotion than that with which they now rest on the noble,
expressive countenance of his wife, as he sings the ancient and
tender strains. Of one of them, I once won from her, amid laughs
and blushes, a few words of translation:—
"Let us hear the sweet echo
Of your sweet voice that charms me.
The one that truly loves you,
He says he wishes to love;
That the one who with ardent love adores you,
Will sacrifice himself for you.
Do not deprive me,
Owner of me,
Of that sweet echo
Of your sweet voice that charms me."

Near the western end of Don Antonio's porch is an orange-tree, on


which were hanging at this time twenty-five hundred oranges, ripe
and golden among the glossy leaves. Under this tree my carriage
always waited for me. The señora never allowed me to depart
without bringing to me, in the carriage, farewell gifts of flowers and
fruit: clusters of grapes, dried and fresh; great boughs full of
oranges, more than I could lift. As I drove away thus, my lap filled
with bloom and golden fruit, canopies of golden fruit over my head,
I said to myself often: "Fables are prophecies. The Hesperides have
come true."

CHANCE DAYS IN OREGON.

The best things in life seem always snatched on chances. The longer
one lives and looks back, the more he realizes this, and the harder
he finds it to "make option which of two," in the perpetually
recurring cases when "there's not enough for this and that," and he
must choose which he will do or take. Chancing right in a decision,
and seeing clearly what a blunder any other decision would have
been, only makes the next such decision harder, and contributes to
increased vacillation of purpose and infirmity of will, until one comes
to have serious doubts whether there be not a truer philosophy in
the "toss up" test than in any other method. "Heads we go, tails we
stay," will prove right as many times out of ten as the most
painstaking pros and cons, weighing, consulting, and slow deciding.
It was not exactly by "heads and tails" that we won our glimpse of
Oregon; but it came so nearly to the same thing that our
recollections of the journey are still mingled with that sort of
exultant sense of delight with which the human mind always regards
a purely fortuitous possession.
Three days and two nights on the Pacific Ocean is a round price to
pay for a thing, even for Oregon, with the Columbia River thrown in.
There is not so misnamed a piece of water on the globe as the
Pacific Ocean, nor so unexplainable a delusion as the almost
universal impression that it is smooth sailing there. It is British
Channel and North Sea and off the Hebrides combined,—as many
different twists and chops and swells as there are waves. People
who have crossed the Atlantic again and again without so much as a
qualm are desperately ill between San Francisco and Portland. There
is but one comparison for the motion: it is as if one's stomach were
being treated as double teeth are handled, when country doctors are
forced to officiate as dentists, and know no better way to get a four-
pronged tooth out of its socket than to turn it round and round till it
is torn loose.
Three days and two nights! I spent no inconsiderable portion of the
time in speculations as to Monsieur Antoine Crozat's probable
reasons for giving back to King Louis his magnificent grant of Pacific
coast country. He kept it five years, I believe. In that time he
probably voyaged up and down its shores thoroughly. Having been
an adventurous trader in the Indies, he must have been well wonted
to seas; and being worth forty millions of livres, he could afford to
make himself as comfortable in the matter of a ship as was possible
a century and a half ago. His grant was a princely domain, an
empire five times larger than France itself. What could he have been
thinking of, to hand it back to King Louis like a worthless bauble of
which he had grown tired? Nothing but the terrors of sea-sickness
can explain it. If he could have foreseen the steam-engine, and have
had a vision of it flying on iron roads across continents and
mountains, how differently would he have conducted! The heirs of
Monsieur Antoine, if any such there be to-day, must chafe when they
read the terms of our Louisiana Purchase.
Three days and two nights—from Thursday morning till Saturday
afternoon—between San Francisco and the mouth of the Columbia,
and then we had to lie at Astoria the greater part of Sunday night
before the tide would let us go on up the river. It was not waste
time, however. Astoria is a place curious to behold. Seen from the
water, it seems a tidy little white town nestled on the shore, and well
topped off by wooded hills. Landing, one finds that it must be
ranked as amphibious, being literally half on land and half on water.
From Astoria proper—the old Astoria, which Mr. Astor founded, and
Washington Irving described—up to the new town, or upper Astoria,
is a mile and a half, two thirds bridges and piers. Long wooden
wharves, more streets than wharves, resting on hundreds of piles,
are built out to deep water. They fairly fringe the shore; and the
street nearest the water is little more than a succession of bridges
from wharf to wharf. Frequent bays and inlets make up, leaving
unsightly muddy wastes when the tide goes out. To see family
washing hung out on lines over these tidal flats, and the family
infants drawing their go-carts in the mud below, was a droll sight. At
least every other building on these strange wharf streets is a salmon
cannery, and acres of the wharf surfaces were covered with salmon
nets spread out to dry. The streets were crowded with wild-looking
men, sailor-like, and yet not sailor-like, all wearing india-rubber
boots reaching far above the knee, with queer wing-like flaps
projecting all around at top. These were the fishers of salmon, two
thousand of them, Russians, Finns, Germans, Italians,—"every kind
on the earth," an old restaurant-keeper said, in speaking of them;
"every kind on the earth, they pour in here, for four months, from
May to September. They're a wild set; clear out with the salmon, 'n'
don't mind any more 'n the fish do what they leave behind 'em."
All day long they kill time in the saloons. The nights they spend on
the water, flinging and trolling and drawing in their nets, which often
burst with the weight of the captured salmon. It is a strange life,
and one sure to foster a man's worst traits rather than his best ones.
The fishermen who have homes and families, and are loyal to them,
industrious and thrifty, are the exception.
The site of Mr. Astor's original fort is now the terraced yard of a
spruce new house on the corner of one of the pleasantest streets in
the old town. These streets are little more than narrow terraces
rising one above the other on jutting and jagged levels of the river-
bank. They command superb off-looks across and up and down the
majestic river, which is here far more a bay than a river. The Astoria
people must be strangely indifferent to these views; for the majority
of the finest houses face away from the water, looking straight into
the rough wooded hillside.
Uncouth and quaint vehicles are perpetually plying between the old
and the new towns; they jolt along fast over the narrow wooden
roads, and the foot-passengers, who have no other place to walk,
are perpetually scrambling from under the horses' heels. It is a
unique highway: pebbly beaches, marshes, and salt ponds, alder-
grown cliffs, hemlock and spruce copses on its inland side; on the
water-side, bustling wharves, canneries, fishermen's boarding-
houses, great spaces filled in with bare piles waiting to be floored; at
every turn shore and sea seem to change sides, and clumps of
brakes, fresh-hewn stumps, maple and madrone trees, shift places
with canneries and wharves; the sea swashes under the planks of
the road at one minute, and the next is an eighth of a mile away, at
the end of a close-built lane. Even in the thickest settled business
part of the town, blocks of water alternate with blocks of brick and
stone.
The statistics of the salmon-canning business almost pass belief. In
1881 six hundred thousand cases of canned salmon were shipped
from Astoria. We ourselves saw seventy-five hundred cases put on
board one steamer. There were forty eight-pound cans in each case;
it took five hours' steady work, of forty "long-shore men," to load
them. These long-shore men are another shifting and turbulent
element in the populations of the river towns. They work day and
night, get big wages, go from place to place, and spend money
recklessly; a sort of commercial Bohemian, difficult to handle and
often dangerous. They sometimes elect to take fifty cents an hour
and all the beer they can drink, rather than a dollar an hour and no
beer. At the time we saw them, they were on beer wages. The
foaming beer casks stood at short intervals along the wharf,—a
pitcher, pail, and mug at each cask. The scene was a lively one: four
cases loaded at a time on each truck, run swiftly to the wharf edge,
and slid down the hold; trucks rattling, turning sharp corners; men
laughing, wheeling to right and left of each other, tossing off mugs
of beer, wiping their mouths with their hands, and flinging the drops
in the air with jests,—one half forgave them for taking part wages in
the beer, it made it so much merrier.
On Sunday morning we waked up to find ourselves at sea in the
Columbia River. A good part of Oregon and Washington Territory
seemed also to be at sea there. When a river of the size of the
Columbia gets thirty feet above low-water mark, towns and
townships go to sea unexpectedly. All the way up the Columbia to
the Willamette, and down the Willamette to Portland, we sailed in
and on a freshet, and saw at once more and less of the country than
could be seen at any other time. At the town of Kalama, facetiously
announced as "the water terminus of the Northern Pacific Railroad,"
the hotel, the railroad station, and its warehouses were entirely
surrounded by water, and we sailed, in seemingly deep water,
directly over the wharf where landings were usually made. At other
towns on the way we ran well up into the fields, and landed
passengers or freight on stray sand-spits, or hillocks, from which
they could get off again on the other side by small boats. We passed
scores of deserted houses, their windows open, the water swashing
over their door-sills; gardens with only tops of bushes in sight, one
with red roses swaying back and forth, limp and helpless on the tide.
It seemed strange that men would build houses and make farms in a
place where they are each year liable to be driven out by such
freshets. When I expressed this wonder, an Oregonian replied lightly,
"Oh, the river always gives them plenty of time. They've all got
boats, and they wait till the last minute always, hoping the water'll
go down."—"But it must be unwholesome to the last degree to live
on such overflowed lands. When the water recedes, they must get
fevers."—"Oh, they get used to it. After they've taken about a barrel
of quinine, they're pretty well acclimated."
Other inhabitants of the country asserted roundly that no fevers
followed these freshets; that the trade-winds swept away all malarial
influences; that the water did no injury whatever to the farms,—on
the contrary, made the crops better; and that these farmers along
the river bottoms "couldn't be hired to live anywhere else in
Oregon."
The higher shore lines were wooded almost without a break; only at
long intervals an oasis of clearing, high up, an emerald spot of
barley or wheat, and a tiny farm-house. These were said to be
usually lumbermen's homes; it was warmer up there than in the
bottom, and crops thrived. In the not far-off day when these
kingdoms of forests are overthrown, and the Columbia runs
unshaded to the sea, these hill shores will be one vast granary.
The city of Portland is on the Willamette River, fourteen miles south
of the junction of that river with the Columbia. Seen from its water
approach, Portland is a picturesque city, with a near surrounding of
hills, wooded with pines and firs, that make a superb sky-line setting
to the town, and to the five grand snow-peaks, of which clear days
give a sight. These dark forests and spear-top fringes are a more
distinctive feature in the beauty of Portland's site than even its fine
waters and islands. It is to be hoped that the Portland people will
appreciate their value, and never let their near hills be shorn of
trees. Not one tree more should be cut. Already there are breaks in
the forest horizons, which mar the picture greatly; and it would take
but a few days of ruthless wood choppers' work to rob the city
forever of its backgrounds, turning them into unsightly barrens. The
city is on both sides of the river, and is called East and West
Portland. With the usual perversity in such cases, the higher ground
and the sunny eastern frontage belong to the less popular part of
the city, the west town having most of the business and all of the
fine houses. Yet in times of freshet its lower streets are always under
water; and the setting-up of back-water into drains, cellars, and
empty lots is a yearly source of much illness. When we arrived, two
of the principal hotels were surrounded by water; from one of them
there was no going out or coming in except by planks laid on trestle-
work in the piazzas, and the air in the lower part of the town was
foul with bad smells from the stagnant water.
Portland is only thirty years old, and its population is not over
twenty-five thousand; yet it is said to have more wealth per head
than any other city in the United States except New Haven. Wheat
and lumber and salmon have made it rich. Oregon wheat brings
such prices in England that ships can afford to cross the ocean to
get it; and last year one hundred and thirty-four vessels sailed out of
Portland harbor, loaded solely with wheat or flour.
The city reminds one strongly of some of the rural towns in New
England. The houses are unpretentious, wooden, either white or of
light colors, and uniformly surrounded by pleasant grounds, in which
trees, shrubs, and flowers grow freely, without any attempt at formal
or decorative culture. One of the most delightful things about the
town is its surrounding of wild and wooded country. In an hour,
driving up on the hills to the west, one finds himself in wildernesses
of woods: spruce, maple, cedar, and pine; dogwood, wild syringa,
honeysuckle, ferns and brakes fitting in for undergrowth; and below
all, white clover matting the ground. By the roadsides are Linnæa,
red clover, yarrow, May-weed, and dandelion, looking to New
England eyes strangely familiar and unfamiliar at once. Never in New
England woods and roadsides do they have such a luxurious diet of
water and rich soil, and such comfortable warm winters. The white
clover especially has an air of spendthrifty indulgence about it which
is delicious. It riots through the woods, even in their densest,
darkest depths, making luxuriant pasturage where one would least
look for it. On these wooded heights are scores of dairy farms, which
have no clearings except of the space needful for the house and
outbuildings. The cows, each with a bell at her neck, go roaming
and browsing all day in the forests. Out of thickets scarcely
penetrable to the eye come everywhere along the road the
contented notes of these bells' slow tinkling at the cows' leisure. The
milk, cream, and butter from these dairy farms are of the excellent
quality to be expected, and we wondered at not seeing "white clover
butter" advertised as well as "white clover honey." Land in these
wooded wilds brings from forty to eighty dollars an acre; cleared, it
is admirable farm land. Here and there we saw orchards of cherry
and apple trees, which were loaded with fruit; the cherry trees so
full that they showed red at a distance.
The alternation of these farms with long tracts of forest, where
spruces and pines stand a hundred and fifty feet high, and myriads
of wild things have grown in generations of tangle, gives to the
country around Portland a charm and flavor peculiarly its own; even
into the city itself extends something of the same charm of contrast
and antithesis; meandering footpaths, or narrow plank sidewalks
with grassy rims, running within stone's-throw of solid brick blocks
and business thoroughfares. One of the most interesting places in
the town is the Bureau of Immigration of the Northern Pacific
Railroad. In the centre of the room stands a tall case, made of the
native Oregon woods. It journeyed to the Paris and the Philadelphia
Expositions, but nowhere can it have given eloquent mute answer to
so many questions as it does in its present place. It now holds jars
of all the grains raised in Oregon and Washington Territory; also
sheaves of superb stalks of the same grains, arranged in circles,—
wheat six feet high, oats ten, red clover over six, and timothy grass
eight. To see Swedes, Norwegians, Germans, Irish, come in, stand
wonderingly before this case, and then begin to ask their jargon of
questions, was an experience which did more in an hour to make
one realize what the present tide of immigration to the New
Northwest really is than reading of statistics could do in a year.
These immigrants are pouring in, it is estimated, at the rate of at
least a hundred and fifty a day,—one hundred by way of San
Francisco and Portland, twenty-five by the Puget Sound ports, and
another twenty-five overland by wagons; no two with the same aim,
no two alike in quality or capacity. To listen to their inquiries and
their narratives, to give them advice and help, requires almost
preternatural patience and sagacity. It might be doubted, perhaps,
whether this requisite combination could be found in an American;
certainly no one of any nationality could fill the office better than it is
filled by the tireless Norwegian who occupies the post at present. It
was touching to see the brightened faces of his countrymen, as their
broken English was answered by him in the familiar words of their
own tongue. He could tell well which parts of the new country would
best suit the Hardanger men, and the men from Eide. It must have
been hard for them to believe his statements, even when indorsed
by the home speech. To the ordinary Scandinavian peasant,
accustomed to measuring cultivable ground by hand-breadths, and
making gardens in pockets in rocks, tales of hundreds of unbroken
miles of wheat country, where crops average from thirty-five to
forty-five bushels an acre, must sound incredible; and spite of their
faith in their countryman, they are no doubt surprised when their
first harvest in the Willamette or Umpqua valley proves that his
statements were under, rather than over, the truth.
The Columbia River steamers set off from Portland at dawn, or
thereabouts. Wise travellers go on board the night before, and their
first morning consciousness is a wonder at finding themselves afloat,
—afloat on a sea; for it hardly seems like river voyaging when shores
are miles apart, and, in many broad vistas, water is all that can be
seen. These vistas, in times of high water, when the Columbia may
be said to be fairly "seas over," are grand. They shine and flicker for
miles, right and left, with green feathery fringes of tree-tops, and
queer brown stippled points and ridges, which are house gables and
roof-trees, not quite gone under. One almost forgets, in the interest
of the spectacle, what misery it means to the owners of the gables
and roof-trees.
At Washougal Landing, on the morning when we went up the river,
all that was to be seen of the warehouse on the wharf at which we
should have made landing was the narrow ridge-line of its roof; and
this was at least a third of a mile out from shore. The boat stopped,
and the passengers were rowed out in boats and canoes, steering
around among tree-tops and houses as best they might.
The true shore-line of the river we never once saw; but it cannot be
so beautiful as was the freshet's shore of upper banks and terraces,
—dark forests at top, shifting shades of blue in every rift between
the hills, iridescent rainbow colors on the slopes, and gray clouds,
white-edged, piled up in masses above them, all floating apace with
us, and changing tone and tint oftener than we changed course.
As we approached the Cascade Mountains, the scenery grew
grander with every mile. The river cuts through this range in a
winding cañon, whose sides for a space of four or five miles are from
three to four thousand feet high. But the charm of this pass is not so
much in the height and grandeur as in the beauty of its walls. They
vary in color and angle, and light and shadow, each second,—
perpendicular rock fronts, mossy brown; shelves of velvety
greenness and ledges of glistening red or black stone thrown across;
great basaltic columns fluted as by a chisel; jutting tables of rock
carpeted with yellow and brown lichen; turrets standing out with firs
growing on them; bosky points of cottonwood trees; yellow and
white blossoms and curtains of ferns, waving out, hanging over; and
towering above all these, peaks and summits wrapped in fleecy
clouds. Looking ahead, we could see sometimes only castellated
mountain lines, meeting across the river, like walls; as we advanced
they retreated, and opened with new vistas at each opening. Shining
threads of water spun down in the highest places, sometimes falling
sheer to the river, sometimes sinking out of sight in forest depths
midway down, like the famed fosses of the Norway fjords. Long sky-
lines of pines and firs, which we knew to be from one hundred to
three hundred feet tall, looked in the aerial perspective no more
than a mossy border along the wall. A little girl, looking up at them,
gave by one artless exclamation a true idea of this effect. "Oh," she
cried, "they look just as if you could pick a little bunch of them." At
intervals along the right-hand shore were to be seen the white-
tented encampments of the Chinese laborers on the road which the
Northern Pacific Railroad Company is building to link St. Paul with
Puget Sound. A force of three thousand Chinamen and two thousand
whites is at work on this river division, and the road is being pushed
forward with great rapidity. The track looked in places as if it were
not one inch out of the water, though it was twenty feet; and
tunnels which were a hundred and thirty feet high looked only like
oven mouths. It has been a hard road to build, costing in some parts
sixty-five thousand dollars a mile. One spot was pointed out to us
where twenty tons of powder had been put in, in seven drifts, and
one hundred and forty cubic yards of rock and soil blown at one
blast into the river. It is an odd thing that huge blasts like this make
little noise, only a slight puff; whereas small blasts make the hills
ring and echo with their racket.
Between the lower cascades and the upper cascades is a portage of
six miles, past fierce waters, in which a boat could scarcely live. Here
we took cars; they were overfull, and we felt ourselves much
aggrieved at being obliged to make the short journey standing on
one of the crowded platforms. It proved to be only another instance
of the good things caught on chances. Next to me stood an old
couple, the man's neck so burnt and wrinkled it looked like fiery red
alligator's skin; his clothes, evidently his best, donned for a journey,
were of a fashion so long gone by that they had a quaint dignity.
The woman wore a checked calico sun-bonnet, and a green merino
gown of as quaint a fashion as her husband's coat. With them was a
veritable Leather Stocking,—an old farmer, whose flannel shirt, tied
loosely at the throat with a bit of twine, fell open, and showed a
broad hairy breast of which a gladiator might have been proud.
The cars jolted heavily, making it hard to keep one's footing; and the
old man came near being shaken off the step. Recovering himself,
he said, laughing, to his friend,—
"Anyhow, it's easier'n a buckin' Cayuse horse."
"Yes," assented the other. "'T ain't much like '49, is it?"
"Were you here in '49?" I asked eagerly.
"'49!" he repeated scornfully. "I was here in '47. I was seven months
comin' across from Iowa to Oregon City in an ox team; an' we're
livin' on that same section we took up then; an' I reckon there hain't
nobody got a lien on to it yet. We've raised nine children, an' the
youngest on em's twenty-one. My woman's been sick for two or
three years; this is the first time I've got her out. Thought we'd go
down to Columbus, an' get a little pleasure, if we can. We used to
come up to this portage in boats, an' then pack everything on horses
an' ride across."
"We wore buckskin clo'es in those days," interrupted Leather
Stocking, "and spurs with bells; needn't do more 'n jingle the bells,
'n' the horse'd start. I'd like to see them times back agen, too. I vow
I'm put to 't now to know where to go. This civilyzation," with an
indescribably sarcastic emphasis on the third syllable, "is too much
for me. I don't want to live where I can't go out 'n' kill a deer before
breakfast any mornin' I take a notion to."
"Were there many Indians here in those days?" I asked.
"Many Injuns?" he retorted; "why, 'twas all Injuns. All this country
'long here was jest full on 'em."
"How did you find them?"
"Jest 's civil 's any people in the world; never had no trouble with
'em. Nobody never did have any thet treated 'em fair. I tell ye, it's
jest with them 's 't is with cattle. Now there 'll be one man raise
cattle, an' be real mean with 'em; an' they'll all hook, an' kick, an'
break fences, an' run away. An' there 'll be another, an' his cattle 'll
all be kind, an' come ter yer when you call 'em. I don't never want to
know anythin' more about a man than the way his stock acts. I
hain't got a critter that won't come up by its name an' lick my hand.
An' it's jest so with folks. Ef a man's mean to you, yer goin' to be
mean to him, every time. The great thing with Injuns is, never to tell
'em a yarn. If yer deceive 'em once, they won't ever trust yer again,
's long's yer live, an' you can't trust them either. Oh, I know Injuns, I
tell you. I've been among 'em here more 'n thirty year, an' I never
had the first trouble yet. There's been troubles, but I wa'n't in 'em.
It's been the white people's fault every time."
"Did you ever know Chief Joseph?" I asked.
"What, old Jo! You bet I knew him. He's an A No. 1 Injun, he is. He's
real honorable. Why, I got lost once, an' I came right on his camp
before I knowed it, an' the Injuns they grabbed me; 't was night, 'n'
I was kind o' creepin' along cautious, an' the first thing I knew there
was an Injun had me on each side, an' they jest marched me up to
Jo's tent, to know what they should do with me. I wa'n't a mite
afraid; I jest looked him right square in the eye. That's another thing
with Injuns; you've got to look 'em in the eye, or they won't trust ye.
Well, Jo, he took up a torch, a pine knot he had burnin', and he held
it close't up to my face, and looked me up an' down, an' down an'
up; an' I never flinched; I jest looked him up an' down's good's he
did me; 'n' then he set the knot down, 'n' told the men it was all
right,—I was 'tum tum;' that meant I was good heart; 'n' they gave
me all I could eat, 'n' a guide to show me my way, next day, 'n' I
couldn't make Jo nor any of 'em take one cent. I had a kind o'
comforter o' red yarn, I wore round my neck; an' at last I got Jo to
take that, jest as a kind o' momento."
The old man was greatly indignant to hear that Chief Joseph was in
Indian Territory. He had been out of the State at the time of the Nez
Percé war, and had not heard of Joseph's fate.
"Well, that was a dirty mean trick!" he exclaimed,—"a dirty mean
trick! I don't care who done it."
Then he told me of another Indian chief he had known well,
—"Ercutch" by name. This chief was always a warm friend of the
whites; again and again he had warned them of danger from hostile
Indians. "Why, when he died, there wa'n't a white woman in all this
country that didn't mourn 's if she'd lost a friend; they felt safe's
long's he was round. When he knew he was dyin' he jest bade all his
friends good-by. Said he, 'Good-by! I'm goin' to the Great Spirit;' an'
then he named over each friend he had, Injuns an' whites, each one
by name, and said good-by after each name."
It was a strange half-hour, rocking and jolting on this crowded car
platform, the splendid tossing and foaming river with its rocks and
islands on one hand, high cliffs and fir forests on the other; these
three weather-beaten, eager, aged faces by my side, with their
shrewd old voices telling such reminiscences, and rising shrill above
the din of the cars.
From the upper cascades to the Dalles, by boat again; a splendid
forty miles' run, through the mountain-pass, its walls now gradually
lowering, and, on the Washington Territory side of the river, terraces
and slopes of cleared lands and occasional settlements. Great
numbers of drift-logs passed us here, coming down apace, from the
rush of the Dalles above. Every now and then one would get tangled
in the bushes and roots on the shore, swing in, and lodge tight to
await the next freshet.
The "log" of one of these driftwood voyages would be interesting; a
tree trunk may be ten years getting down to the sea, or it may swirl
down in a week. It is one of the businesses along the river to catch
them, and pull them in to shore, and much money is made at it. One
lucky fisher of logs, on the Snake River Fork, once drew ashore six
hundred cords in a single year. Sometimes a whole boom gets loose
from its moorings, and comes down stream, without breaking up.
This is a godsend to anybody who can head it off and tow it in
shore; for by the law of the river he is entitled to one half the value
of the logs.
At the Dalles is another short portage of twelve miles, past a portion
of the river which, though less grand than its plunge through the
Cascade Mountains, is far more unique and wonderful. The waters
here are stripped and shred into countless zigzagging torrents,
boiling along through labyrinths of black lava rocks and slabs. There
is nothing in all Nature so gloomy, so weird, as volcanic slag; and the
piles, ridges, walls, palisades of it thrown up at this point look like
the roof-trees, chimneys, turrets of a half-engulfed Pandemonium.
Dark slaty and gray tints spread over the whole shore, also; it is all
volcanic matter, oozed or boiled over, and hardened into rigid shapes
of death and destruction. The place is terrible to see. Fitting in well
with the desolateness of the region was a group of half-naked
Indians crouching on the rocks, gaunt and wretched, fishing for
salmon; the hollows in the rocks about them filled with the bright
vermilion-colored salmon spawn, spread out to dry. The twilight was
nearly over as we sped by, and the deepening darkness added
momently to the gloom of the scene.
At Celilo, just above the Dalles, we took boat again for Umatilla, one
hundred miles farther up the river.
Next morning we were still among lava beds: on the Washington
Territory side, low, rolling shores, or slanting slopes with terraces,
and tufty brown surfaces broken by ridges and points of the black
slag; on the Oregon side, high brown cliffs mottled with red and
yellow lichens, and great beaches and dunes of sand, which had
blown into windrows and curving hillock lines as on the sea-shore.
This sand is a terrible enemy for a railroad to fight. In a few hours,
sometimes, rods of the track are buried by it as deep as by snow in
the fiercest winter storms.
The first picture I saw from my state-room windows, this morning,
was an Indian standing on a narrow plank shelf that was let down by
ropes over a perpendicular rock front, some fifty feet high. There he
stood, as composed as if he were on terra firma, bending over
towards the water, and flinging in his salmon net. On the rocks
above him sat the women of his family, spreading the salmon to dry.
We were within so short a distance of the banks that friendly smiles
could be distinctly seen; and one of the younger squaws, laughing
back at the lookers-on on deck, picked up a salmon, and waving it in
her right hand ran swiftly along towards an outjutting point. She was
a gay creature, with scarlet fringed leggings, a pale green blanket,
and on her head a twisted handkerchief of a fine old Dürer red. As
she poised herself, and braced backwards to throw the salmon on
deck, she was a superb figure against the sky; she did not throw
straight, and the fish fell a few inches short of reaching the boat. As
it struck the water she made a petulant little gesture of
disappointment, like a child, threw up her hands, turned, and ran
back to her work.
At Umatilla, being forced again to "make option which of two," we
reluctantly turned back, leaving the beautiful Walla Walla region
unvisited, for the sake of seeing Puget Sound. The Walla Walla
region is said to be the finest stretch of wheat country in the world.
Lava slag, when decomposed, makes the richest of soil,—deep and
seemingly of inexhaustible fertility. A failure of harvests is said never
to have been known in that country; the average yield of wheat is
thirty-five to forty bushels an acre, and oats have yielded a hundred
bushels. Apples and peaches thrive, and are of a superior quality.
The country is well watered, and has fine rolling plateaus from
fifteen hundred to three thousand feet high, giving a climate neither
too cold in winter nor too hot in summer, and of a bracing quality
not found nearer the sea. Hearing all the unquestionable tributes to
the beauty and value of this Walla Walla region, I could not but
recall some of Chief Joseph's pleas that a small share of it should be
left in the possession of those who once owned it all.
From our pilot, on the way down, I heard an Indian story, too
touching to be forgotten, though too long to tell here except in
briefest outline. As we were passing a little village, half under water,
he exclaimed, looking earnestly at a small building to whose
window-sills the water nearly reached: "Well, I declare, Lucy's been
driven out of her house this time. I was wondering why I didn't see
her handkerchief a-waving. She always waves to me when I go by."
Then he told me Lucy's story.
She was a California Indian, probably of the Tulares, and migrated to
Oregon with her family thirty years ago. She was then a young girl,
and said to be the handsomest squaw ever seen in Oregon. In those
days white men in wildernesses thought it small shame, if any, to
take Indian women to live with them as wives, and Lucy was much
sought and wooed. But she seems to have had uncommon virtue or
coldness, for she resisted all such approaches for a long time.
Finally, a man named Pomeroy appeared; and, as Lucy said
afterward, as soon as she looked at him, she knew he was her "tum
tum man," and she must go with him. He had a small sloop, and
Lucy became its mate. They two alone ran it for several years up
and down the river. He established a little trading-post, and Lucy
always took charge of that when he went to buy goods. When gold
was discovered at Ringgold Bar, Lucy went there, worked with a
rocker like a man, and washed out hundreds of dollars' worth of
gold, all which she gave to Pomeroy. With it he built a fine schooner
and enlarged his business, the faithful Lucy working always at his
side and bidding. At last, after eight or ten years, he grew weary of
her and of the country, and made up his mind to go to California.
But he had not the heart to tell Lucy he meant to leave her. The pilot
who told me this story was at that time captain of a schooner on the
river. Pomeroy came to him one day, and asked him to move Lucy
and her effects down to Columbus. He said he had told her that she
must go and live there with her relatives, while he went to California
and looked about, and then he would send for her. The poor
creature, who had no idea of treachery, came on board cheerfully
and willingly, and he set her off at Columbus. This was in the early
spring. Week after week, month after month, whenever his schooner
stopped there, Lucy was on the shore, asking if he had heard from
Pomeroy. For a long time, he said, he couldn't bear to tell her. At last
he did; but she would not believe him. Winter came on. She had got
a few boards together and built herself a sort of hut, near a house
where lived an eccentric old bachelor, who finally took compassion
on her, and to save her from freezing let her come into his shanty to
sleep. He was a mysterious old man, a recluse, with a morbid
aversion to women; and at the outset it was a great struggle for him
to let even an Indian woman cross his threshold. But little by little
Lucy won her way: first she washed the dishes; then she would
timidly help at the cooking. Faithful, patient, unpresuming, at last
she grew to be really the old man's housekeeper as well as servant.
He lost his health, and became blind. Lucy took care of him till he
died, and followed him to the grave, his only mourner,—the only
human being in the country with whom he had any tie. He left her
his little house and a few hundred dollars,—all he had; and there she
is still, alone, making out to live by doing whatever work she can
find in the neighborhood. Everybody respects her; she is known as
"Lucy" up and down the river. "I did my best to hire her to come and
keep house for my wife, last year," said the pilot. "I'd rather have her
for nurse or cook than any white woman in Oregon. But she
wouldn't come. I don't know as she's done looking for Pomeroy to
come back yet, and she's going to stay just where he left her. She
never misses a time, waving to me, when she knows what boat I'm
on; and there isn't much going on on the river she don't know."
It was dusk when the pilot finished telling Lucy's story. We were
shooting along through wild passages of water called Hell Gate, just
above the Dalles. In the dim light the basaltic columnar cliffs looked
like grooved ebony. One of the pinnacles has a strange resemblance
to the figure of an Indian. It is called the Chief, and the semblance is
startling,—a colossal figure, with a plume-crowned head, turned as if
gazing backward over the shoulder; the attitude stately, the drapery
graceful, and the whole expression one of profound and dignified
sorrow. It seemed a strangely fitting emphasis to the story of the
faithful Indian woman.
It was near midnight when we passed the Dalles. Our train was late,
and dashed on at its swiftest. Fitful light came from a wisp of a new
moon and one star; they seemed tossing in a tumultuous sea of dark
clouds. In this glimmering darkness the lava walls and ridges stood
up, inky black; the foaming water looked like molten steel, the whole
region more ghastly and terrible than before.
There is a village of three thousand inhabitants at the Dalles. The
houses are set among lava hillocks and ridges. The fields seemed
bubbled with lava, their blackened surfaces stippled in with yellow
and brown. High up above are wheat-fields in clearings, reaching to
the sky-line of the hills. Great slopes of crumbling and disintegrating
lava rock spread superb purple and slate colors between the greens
of forests and wheat-fields. It is one of the memorable pictures on
the Columbia.
To go both up and down a river is a good deal like spending a
summer and a winter in a place, so great difference does it make
when right hand and left shift sides, and everything is seen from a
new stand-point.
The Columbia River scenery is taken at its best going up, especially
the gradual crescendo of the Cascade Mountain region, which is far
tamer entered from above. But we had a compensation in the
clearer sky and lifted clouds, which gave us the more distant snow-
peaks in all their glory; and our run down from the Dalles to Portland
was the best day of our three on the river. Our steamer was steered
by hydraulic pressure; and it was a wonderful thing to sit in the pilot-
house and see the slight touch of a finger on the shining lever sway
the great boat in a second. A baby's hand is strong enough to steer
the largest steamboat by this instrument. It could turn the boat, the
captain said, in a maelstrom, where four men together could not
budge the rudder-wheel.
The history of the Columbia River navigation would make by itself an
interesting chapter. It dates back to 1792, when a Boston ship and a
Boston captain first sailed up the river. A curious bit of history in
regard to that ship is to be found in the archives of the old Spanish
government in California. Whenever a royal decree was issued in
Madrid in regard to the Indies or New Spain, a copy of it was sent to
every viceroy in the Spanish Dominions; he communicated it to his
next subordinate, who in turn sent it to all the governors, and so on,
till the decree reached every corner of the king's provinces. In 1789
there was sent from Madrid, by ship to Mexico, and thence by
courier to California, and by Fages, the California governor, to every
port in California, the following order:—
"Whenever there may arrive at the port of San Francisco a
ship named the 'Columbia,' said to belong to General
Washington of the American States, commanded by John
Kendrick, which sailed from Boston in 1787, bound on a
voyage of discovery to the Russian settlements on the
northern coast of the peninsula, you will cause said vessel
to be examined with caution and delicacy, using for this
purpose a small boat which you have in your possession."
Two months after this order was promulgated in the Santa Barbara
presidio, Captain Gray, of the ship "Washington," and Captain
Kendrick of the ship "Columbia," changed ships in Wickmanish
harbor. Captain Gray took the "Columbia" to China, and did not sail
into San Francisco harbor at all, whereby he escaped being
"examined with caution and delicacy" by the small boat in
possession of the San Francisco garrison. Not till the 11th of May,
1792, did he return and sail up the Columbia River, then called the
Oregon. He renamed it, for his ship, "Columbia's River;" but the
possessive was soon dropped.
When one looks at the crowded rows of steamboats at the Portland
wharves now, it is hard to realize that it is only thirty-two years since
the first one was launched there. Two were built and launched in
one year, the "Columbia" and the "Lot Whitcomb." The "Lot
Whitcomb" was launched on Christmas Day; there were three days'
feasting and dancing, and people gathered from all parts of the
Territory to celebrate the occasion.
It is also hard to realize, when standing on the Portland wharves,
that it is less than fifty years since there were angry discussions in
the United States Congress as to whether or not it were worth while
to obtain Oregon as a possession, and in the Eastern States manuals
were being freely distributed, bearing such titles as this: "A general
circular to all persons of good character wishing to emigrate to the
Oregon Territory." Even those statesmen who were most earnest in
favor of the securing of Oregon did not perceive the true nature of
its value. One of Benton's most enthusiastic predictions was that an
"emporium of Asiatic commerce" would be situated at the mouth of
the Columbia, and that "a stream of Asiatic trade would pour into
the valley of the Mississippi through the channel of Oregon." But the
future of Oregon and Washington rests not on any transmission of
the riches of other countries, however important an element in their
prosperity that may ultimately become. Their true riches are their
own and inalienable. They are to be among the great feeders of the
earth. Gold and silver values are unsteady and capricious; intrigues
can overthrow them; markets can be glutted, and mines fail. But
bread the nations of the earth must have. The bread-yielder controls
the situation always. Given a soil which can grow wheat year after
year with no apparent fatigue or exhaustion, a climate where rains
never fail and seed-time and harvest are uniformly certain, and
conditions are created under which the future success and wealth of
a country may be predicted just as surely as the movements of the
planets in the heavens.
There are three great valleys in western Oregon,—the Willamette,
the Umpqua, and the Rogue River. The Willamette is the largest,
being sixty miles long by one hundred and fifty wide. The Umpqua
and Rogue River together contain over a million of acres. These
valleys are natural gardens; fertile to luxuriance, and watered by all
the westward drainage of the great Cascade Range, the Andes of
North America, a continuation of the Sierra Nevada. The Coast
Range Mountains lie west of these valleys, breaking, but not shutting
out, the influence of the sea air and fogs. This valley region between
these two ranges contains less than a third of the area of
Washington and Oregon. The country east of the Cascade Mountains
is no less fertile, but has a drier climate, colder winters, and hotter
summers. Its elevation is from two to four thousand feet,—probably
the very best elevations for health. A comparison of statistics of
yearly death-rates cannot be made with absolute fairness between
old and thick-settled and new and sparsely settled countries.
Allowance must be made for the probably superior health and
strength of the men and women who have had the youth and
energy to go forward as pioneers. But, making all due allowance for
these, there still remains difference enough to startle one between
the death-rates in some of the Atlantic States and in these infant
empires of the New Northwest. The yearly death-rate in
Massachusetts is one out of fifty-seven; in Vermont one out of
ninety-seven; in Oregon one out of one hundred and seventy-two;
and in Washington Territory one out of two hundred and twenty-
eight.
As we glided slowly to anchorage in Portland harbor, five dazzling
snow-white peaks were in sight on the horizon,—Mount Hood, of
peerless shape, strong as if it were a bulwark of the very heavens
themselves, yet graceful and sharp-cut as Egypt's pyramids; St.
Helen's, a little lower, yet looking higher, with the marvellous curves
of its slender shining cone, bent on and seemingly into the sky, like
an intaglio of ice cut in the blue; miles away in the farthest north
and east horizons, Mounts Tacoma and Adams and Baker, all
gleaming white, and all seeming to uphold the skies.
These eternal, unalterable snow-peaks will be as eternal and
unalterable factors in the history of the country as in its beauty to
the eye. Their value will not come under any head of things
reckonable by census, statistics, or computation, but it will be none
the less real for that: it will be an element in the nature and
character of every man and woman born within sight of the radiant
splendor; and it will be strange if it does not ultimately develop, in
the empire of this New Northwest, a local patriotism and passionate
loyalty to soil as strong and lasting as that which has made
generations of Swiss mountaineers ready to brave death for a sight
of their mountains.
II.

SCOTLAND AND ENGLAND.


A BURNS PILGRIMAGE.

A shining-beached crescent of country facing to the sunset, and


rising higher and higher to the east till it becomes mountain, is the
county of Ayrshire, fair and famous among the southern Scotch
highlands. To a sixty-mile measure by air, between its north and
south promontories, it stretches a curving coast of ninety; and when
Robert Burns strolled over its breezy uplands, he saw always
beautiful and mysterious silver lines of land thrusting themselves out
into the mists of the sea, pointing to far-off island peaks, seeming
sometimes to bridge and sometimes to wall vistas ending only in sky.
These lines are as beautiful, elusive, and luring now as then, and in
the inalienable loyalty of nature bear testimony to-day to their lover.
This is the greatest crown of the hero and the poet. Other great men
hold fame by failing records which moth and fire destroy. The places
that knew them know them no more when they are dead. Marble
and canvas and parchment league in vain to keep green the memory
of him who did not love and consecrate by his life-blood, in fight or
in song, the soil where he trod. But for him who has done this,—who
fought well, sang well,—the morning cloud, and the wild rose, and
broken blades of grass under men's feet, become immortal
witnesses; so imperishable, after all, are what we are in the habit of
calling the "perishable things of this earth."
More than two hundred years ago, when the followers and holders
of the different baronies of Ayrshire compared respective dignities
and values, they made a proverb which ran:—
"Carrick for a man; Kyle for a coo;
Cunningham for butter and cheese; Galloway for woo."

Before the nineteenth century set in, the proverb should have been
changed; for Kyle is the land through which "Bonnie Doon" and
Irvine Water run, and there has been never a man in all Carrick of
whom Carrick can be proud as is Kyle of Robert Burns. It has been
said that a copy of his poems lies on every Scotch cottager's shelf,
by the side of the Bible. This is probably not very far from the truth.
Certain it is, that in the villages where he dwelt there seems to be
no man, no child, who does not apparently know every detail of the
life he lived there, nearly a hundred years ago.
"Will ye be drivin' over to Tarbolton in the morning?" said the pretty
young vice-landlady of the King's Arms at Ayr, when I wrote my
name in her visitors' book late one Saturday night.
"What made you think of that?" I asked, amused.
"And did ye not come on account o' Burns?" she replied. "There's
been a many from your country here by reason of him this summer.
I think you love him in America a'most as well as we do oursel's. It's
vary seldom the English come to see anythin' aboot him. They've so
many poets o' their own, I suppose, is the reason o' their not thinkin'
more o' Burns."
All that there was unflattering in this speech I forgave by reason of
the girl's sweet low voice, pretty gray eyes, and gentle, refined
hospitality. She might have been the daughter of some country
gentleman, welcoming a guest to the house; and she took as much
interest in making all the arrangements for my drive to Tarbolton the
next morning as if it had been a pleasure excursion for herself. It is
but a dull life she leads, helping her widowed mother keep the King's
Arms,—dull, and unprofitable too, I fear; for it takes four men-
servants and seven women to keep up the house, and I saw no
symptom of any coming or going of customers in it. A stillness as of
a church on weekdays reigned throughout the establishment. "At the
races and when the yeomanry come," she said, there was something
to do; but "in the winter nothing, except at the times of the county
balls. You know, ma'am, we've many county families here," she
remarked with gentle pride, "and they all stop with us."
There is a compensation to the lower orders of a society where rank
and castes are fixed, which does not readily occur at first sight to
the democratic mind naturally rebelling against such defined
distinctions. It is very much to be questioned whether, in a republic,
the people who find themselves temporarily lower down in the social
scale than they like to be or expect to stay, feel, in their
consciousness of the possibility of rising, half so much pride or
satisfying pleasure as do the lower classes in England, for instance,
in their relations with those whom they serve, whose dignity they
seem to share by ministering to it.
The way from Ayr to Tarbolton must be greatly changed since the
day when the sorrowful Burns family trod it, going from the Mount
Oliphant farm to that of Lochlea. Now it is for miles a smooth road,
on which horses' hoofs ring merrily, and neat little stone houses,
with pretty yards, line it on both sides for some distance. The
ground rises almost immediately, so that the dwellers in these little
suburban houses get fine off-looks seaward and a wholesome breeze
in at their windows. The houses are built joined by twos, with a yard
in common. They have three rooms besides the kitchen, and they
rent for twenty-five pounds a year; so no industrious man of Ayr
need be badly lodged. Where the houses leave off, hedges begin,—
thorn and beech, untrimmed and luxuriant, with great outbursts of
white honeysuckle and sweet-brier at intervals. As far as the eye
could see were waving fields of wheat, oats, and "rye-grass," which
last being just ripe was of a glorious red color. The wheat-fields were
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookluna.com

You might also like