SlideShare a Scribd company logo
Java Illuminated An Active Learning Approach 5th
Julie Anderson download
https://ebookbell.com/product/java-illuminated-an-active-
learning-approach-5th-julie-anderson-34812764
Explore and download more ebooks at ebookbell.com
Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Java Illuminated An Active Learning Approach 5th Julie Anderson
https://ebookbell.com/product/java-illuminated-an-active-learning-
approach-5th-julie-anderson-34809294
Java Illuminated An Active Learning Approach 4th Edition Julie
Anderson
https://ebookbell.com/product/java-illuminated-an-active-learning-
approach-4th-edition-julie-anderson-6738268
Java Illuminated An Active Learning Approach 6th Edition 6th Julie A
Anderson
https://ebookbell.com/product/java-illuminated-an-active-learning-
approach-6th-edition-6th-julie-a-anderson-50732572
Java Illuminated An Active Learning Approach 4th Edition Julie
Anderson
https://ebookbell.com/product/java-illuminated-an-active-learning-
approach-4th-edition-julie-anderson-5688376
Buddhism Illuminated Manuscript Art From Southeast Asia San San May
https://ebookbell.com/product/buddhism-illuminated-manuscript-art-
from-southeast-asia-san-san-may-7402618
Java The Ultimate Guide To Learn Java And Python Programming Peter
Hoffman Stephen Hoffman
https://ebookbell.com/product/java-the-ultimate-guide-to-learn-java-
and-python-programming-peter-hoffman-stephen-hoffman-50199732
Java The Ultimate Guide To Learn Java Programming And Computer Hacking
Java For Beginners Java For Dummies Java Apps Hacking Html Javascript
Programming Developers Coding Css Php Book 2 Peter Hoffman Hoffman
https://ebookbell.com/product/java-the-ultimate-guide-to-learn-java-
programming-and-computer-hacking-java-for-beginners-java-for-dummies-
java-apps-hacking-html-javascript-programming-developers-coding-css-
php-book-2-peter-hoffman-hoffman-7431836
Java An Introduction To Problem Solving And Programming 7th Edition
Walter Savith
https://ebookbell.com/product/java-an-introduction-to-problem-solving-
and-programming-7th-edition-walter-savith-46196888
Java For Developers Pocket Primer Oswald Campesato
https://ebookbell.com/product/java-for-developers-pocket-primer-
oswald-campesato-47386772
Java Illuminated An Active Learning Approach 5th Julie Anderson
Java Illuminated An Active Learning Approach 5th Julie Anderson
JAVA
Illuminated
An Active Learning Approach
FIFTH EDITION
Julie Anderson
Rollins College
Hervé Franceschi
Loyola University Maryland
JONES BARTLETT
LEARNING
™
World Headquarters
Jones & Bartlett Learning
5 Wall Street
Burlington, MA 01803
978-443-5000
info@jblearning.com
www.jblearning.com
Jones & Bartlett Learning books and products are
available through most bookstores and online
booksellers. To contact Jones & Bartlett Learning
directly, call 800-832-0034, fax 978-443-8000, or visit
our website, www.jblearning.com.
Substantial discounts on bulk quantities of Jones
& Bartlett Learning publications are available to
corporations, professional associations, and
other qualified organizations. For details and
specific discount information, contact the special
sales department at Jones & Bartlett Learning via
the above contact information or send an email to
specialsales@jblearning.com.
Copyright © 2019 by Jones & Bartlett Learning, LLC,
an Ascend Learning Company
All rights reserved. No part of the material protected
by this copyright may be reproduced or utilized in
any form, electronic or mechanical, including
photocopying, recording, or by any information
storage and retrieval system, without written
permission from the copyright owner.
The content, statements, views, and opinions herein
are the sole expression of the respective authors and
not that of Jones & Bartlett Learning, LLC. Reference
herein to any specific commercial product, process,
or service by trade name, trademark, manufacturer,
or otherwise does not constitute or imply its
endorsement or recommendation by Jones & Bartlett
Learning, LLC and such reference shall not be used
for advertising or product endorsement purposes. All
trademarks displayed are the trademarks of the
parties noted herein. Java Illuminated, Fifth Edition,
is an independent publication and has not been
authorized, sponsored, or otherwise approved by the
owners of the trademarks or service marks
referenced in this product.
There may be images in this book that feature
models; these models do not necessarily endorse,
represent, or participate in the activities represented
in the images. Any screenshots in this product are
for educational and instructive purposes only. Any
individuals and scenarios featured in the case
studies throughout this product may be real or
fictitious, but are used for instructional purposes only.
23993-5
Production Credits
Director of Product Management: Matthew Kane
Product Manager: Laura Pagluica
Product Assistant: Rebecca Feeney
Production Manager: Carolyn Pershouse
Production Manager: Dan Stone
VP, Manufacturing and Inventory Control: Therese
Connell
Media Development Editor: Shannon Sheehan
Rights & Media Specialist: Thais Miller
Cover & Title Page Design: Kristin E. Parker
Cover Image (Title Page, Part Opener, Chapter
Opener): © itsskin/Getty Images
Printing and Binding: LSC Communications
Cover Printing: LSC Communications
Library of Congress Cataloging-in-Publication
Data
ISBN13: 978-1-284-23993-5
Application submitted.
6048
Printed in the United States of America
22 21 20 19 18 10 9 8 7 6 5 4 3 2 1
Dedications
To the memory of my parents, Glenn and Rosemary
Austin, my first teachers. – Julie Anderson
A ma mère, trop tôt disparue, et à mon père. – Hervé
Franceschi
Contents
Preface
Turing’s Craft CodeLab Student
Registration Instructions
Acknowledgments
Chapter 1 Introduction to Programming and the
Java Language
1.1 Basic Computer Concepts
1.1.1 Hardware
1.1.2 Operating Systems
1.1.3 Application Software
1.1.4 Computer Networks and the Internet
1.2 Practice Activity: Displaying System
Configuration
1.2.1 Displaying Windows Configuration
Information
1.2.2 Displaying Mac OS Configuration
Information
1.3 Data Representation
1.3.1 Binary Numbers
1.3.2 Using Hexadecimal Numbers to
Represent Binary Numbers
1.3.3 Representing Characters with the
Unicode Character Set
1.4 Programming Languages
1.4.1 High- and Low-Level Languages
1.4.2 An Introduction to Object-Oriented
Programming
1.4.3 The Java Language
1.5 An Introduction to Programming
1.5.1 Programming Basics
1.5.2 Program Design with Pseudocode
1.5.3 Developing a Java Application
1.5.4 Programming Activity 1: Writing a
First Java Application
Debugging Techniques
Testing Techniques
1.5.5 Making a JAR File
1.6 Chapter Summary
1.7 Exercises, Problems, and Projects
1.7.1 Multiple Choice Exercises
1.7.2 Converting Numbers
1.7.3 General Questions
1.7.4 Technical Writing
1.7.5 Group Project (for a group of 1, 2, or 3
students)
Chapter 2 Programming Building Blocks—Java
Basics
2.1 Java Application Structure
2.2 Data Types, Variables, and Constants
2.2.1 Declaring Variables
2.2.2 Integer Data Types
2.2.3 Floating-Point Data Types
2.2.4 Character Data Type
2.2.5 Boolean Data Type
2.2.6 The Assignment Operator, Initial
Values, and Literals
2.2.7 String Literals and Escape
Sequences
2.2.8 Constants
2.3 Expressions and Arithmetic Operators
2.3.1 The Assignment Operator and
Expressions
2.3.2 Arithmetic Operators
2.3.3 Operator Precedence
2.3.4 Programming Activity 1: Converting
Inches to Centimeters
2.3.5 Integer Division and Modulus
2.3.6 Division by Zero
2.3.7 Mixed-Type Arithmetic and Type
Casting
2.3.8 Shortcut Operators
2.4 Programming Activity 2: Temperature
Conversion
2.5 Chapter Summary
2.6 Exercises, Problems, and Projects
2.6.1 Multiple Choice Exercises
2.6.2 Reading and Understanding Code
2.6.3 Fill In the Code
2.6.4 Identifying Errors in Code
2.6.5 Debugging Area—Using Messages
from the Java Compiler and Java
JVM
2.6.6 Write a Short Program
2.6.7 Programming Projects
2.6.8 Technical Writing
Chapter 3 Object-Oriented Programming, Part 1:
Using Classes
3.1 Class Basics and Benefits
3.2 Creating Objects Using Constructors
3.3 Calling Methods
3.4 Using Object References
3.5 Programming Activity 1: Calling Methods
3.6 The Java Class Library
3.7 The String Class
The length Method
The toUpperCase and
toLowerCase Methods
The charAt Method
The indexOf Methods
The substring Methods
String Processing
3.8 Formatting Output with the
DecimalFormat Class
3.9 Generating Random Numbers with the
Random Class
3.10 Input from the Console Using the
Scanner Class
3.11 Calling Static Methods and Using
Static Class Variables
3.12 Using System.in and System.out
3.13 The Math Class
The pow Method
The round Method
The min and max Methods
3.14 Formatting Output with the
NumberFormat Class
3.15 The Integer, Double, Character, and Other
Wrapper Classes
3.16 Programming Activity 2: Using Predefined
Classes
3.17 Chapter Summary
3.18 Exercises, Problems, and Projects
3.18.1 Multiple Choice Exercises
3.18.2 Reading and Understanding Code
3.18.3 Fill In the Code
3.18.4 Identifying Errors in Code
3.18.5 Debugging Area—Using Messages
from the Java Compiler and Java
JVM
3.18.6 Write a Short Program
3.18.7 Programming Projects
3.18.8 Technical Writing
3.18.9 Group Project (for a group of 1, 2, or
3 students)
Chapter 4 Introduction to Graphical
Applications
4.1 JavaFX Application Structure
4.2 The Graphics Coordinate System and Color
4.3 Drawing Shapes and Text
4.4 Drawing Custom Shapes
4.5 Programming Activity 1: Writing an
Application with Graphics
4.6 Chapter Summary
4.7 Exercises, Problems, and Projects
4.7.1 Multiple Choice Exercises
4.7.2 Reading and Understanding Code
4.7.3 Fill In the Code
4.7.4 Identifying Errors in Code
4.7.5 Debugging Area—Using Messages
from the Java Compiler and Java
JVM
4.7.6 Write a Short Program
4.7.7 Programming Projects
4.7.8 Technical Writing
4.7.9 Group Project (for a group of 1, 2, or 3
students)
Chapter 5 Flow of Control, Part 1: Selection
5.1 Forming Conditions
5.1.1 Equality Operators
5.1.2 Relational Operators
5.1.3 Logical Operators
DeMorgan’s Laws
5.2 Simple Selection with if
5.3 Selection Using if/else
Block Scope
5.4 Selection Using if/else if
5.5 Sequential and Nested if/else Statements
5.5.1 Sequential if/else Statements
Finding the Minimum or
Maximum Values
5.5.2 Nested if/else Statements
Dangling else
5.6 Testing Techniques for if/else Statements
5.7 Programming Activity 1: Working with if/else
5.8 Comparing Floating-Point Numbers
5.9 Comparing Objects
5.9.1 The equals Method
5.9.2 String Comparison Methods
5.10 The Conditional Operator (?:)
5.11 The switch Statement
5.12 Programming Activity 2: Using the
switch Statement
5.13 Chapter Summary
5.14 Exercises, Problems, and Projects
5.14.1 Multiple Choice Exercises
5.14.2 Reading and Understanding Code
5.14.3 Fill In the Code
5.14.4 Identifying Errors in Code
5.14.5 Debugging Area—Using Messages
from the Java Compiler and Java
JVM
5.14.6 Write a Short Program
5.14.7 Programming Projects
5.14.8 Technical Writing
5.14.9 Group Project (for a group of 1, 2, or
3 students)
Chapter 6 Flow of Control, Part 2: Looping
6.1 Event-Controlled Loops Using while
6.2 General Form for while Loops
6.3 Event-Controlled Looping
6.3.1 Reading Data from the User
6.3.2 Reading Data from a Text File
6.4 Looping Techniques
6.4.1 Accumulation
6.4.2 Counting Items
6.4.3 Calculating an Average
6.4.4 Finding Maximum or Minimum Values
6.5 Type-Safe Input Using Scanner
6.6 Constructing Loop Conditions
6.7 Testing Techniques for while Loops
6.8 Event-Controlled Loops Using do/while
6.9 Programming Activity 1: Using while Loops
Task Instructions
Troubleshooting
6.10 Count-Controlled Loops Using for
6.10.1 Basic Structure of for Loops
6.10.2 Constructing for Loops
6.10.3 Testing Techniques for for Loops
6.11 Nested Loops
6.12 Programming Activity 2: Using for Loops
Instructions
Troubleshooting
6.13 Chapter Summary
6.14 Exercises, Problems, and Projects
6.14.1 Multiple Choice Exercises
6.14.2 Reading and Understanding Code
6.14.3 Fill In the Code
6.14.4 Identifying Errors in Code
6.14.5 Debugging Area—Using Messages
from the Java Compiler and Java
JVM
6.14.6 Write a Short Program
6.14.7 Programming Projects
6.14.8 Technical Writing
6.14.9 Group Project (for a group of 1, 2, or
3 students)
Chapter 7 Object-Oriented Programming, Part 2:
User-Defined Classes
7.1 Defining a Class
7.2 Defining Instance Variables
7.3 Writing Class Methods
7.4 Writing Constructors
7.5 Writing Accessor Methods
7.6 Writing Mutator Methods
7.7 Writing Data Manipulation Methods
7.8 Programming Activity 1: Writing a Class
Definition, Part 1
7.9 The Object Reference this
7.10 The toString and equals Methods
7.11 Static Class Members
7.12 Graphical Objects
7.13 Enumeration Types
7.14 Programming Activity 2: Writing a Class
Definition, Part 2
7.15 Creating Packages
7.16 Generating Web-Style Documentation with
Javadoc
7.17 Chapter Summary
7.18 Exercises, Problems, and Projects
7.18.1 Multiple Choice Exercises
7.18.2 Reading and Understanding Code
7.18.3 Fill In the Code
7.18.4 Identifying Errors in Code
7.18.5 Debugging Area—Using Messages
from the Java Compiler and Java
JVM
7.18.6 Write a Short Program
7.18.7 Programming Projects
7.18.8 Technical Writing
7.18.9 Group Project (for a group of 1, 2, or
3 students)
Chapter 8 Single-Dimensional Arrays
8.1 Declaring and Instantiating Arrays
8.1.1 Declaring Arrays
8.1.2 Instantiating Arrays
8.1.3 Combining the Declaration and
Instantiation of Arrays
8.1.4 Assigning Initial Values to Arrays
8.2 Accessing Array Elements
8.3 Aggregate Array Operations
8.3.1 Printing Array Elements
8.3.2 Reading Data into an Array
8.3.3 Summing the Elements of an Array
8.3.4 Finding Maximum or Minimum Values
8.3.5 Copying Arrays
8.3.6 Changing the Size of an Array
8.3.7 Comparing Arrays for Equality
8.3.8 Displaying Array Data as a Bar Chart
8.4 Programming Activity 1: Working with Arrays
Instructions
Troubleshooting
8.5 Using Arrays in Classes
8.5.1 Using Arrays in User-Defined Classes
8.5.2 Retrieving Command Line Arguments
8.6 Searching and Sorting Arrays
8.6.1 Sequential Search of an Unsorted
Array
8.6.2 Selection Sort
8.6.3 Insertion Sort
8.6.4 Sorting Arrays of Objects
8.6.5 Sequential Search of a Sorted Array
8.6.6 Binary Search of a Sorted Array
8.7 Programming Activity 2: Searching and
Sorting Arrays
Instructions
Troubleshooting
8.8 Using Arrays as Counters
8.9 Methods Accepting a Variable Number of
Arguments
8.10 Chapter Summary
8.11 Exercises, Problems, and Projects
8.11.1 Multiple Choice Exercises
8.11.2 Reading and Understanding Code
8.11.3 Fill In the Code
8.11.4 Identifying Errors in Code
8.11.5 Debugging Area—Using Messages
from the Java Compiler and Java
JVM
8.11.6 Write a Short Program
8.11.7 Programming Projects
8.11.8 Technical Writing
8.11.9 Group Project (for a group of 1, 2, or
3 students)
Chapter 9 Multidimensional Arrays and the
ArrayList Class
9.1 Declaring and Instantiating Multidimensional
Arrays
9.1.1 Declaring Multidimensional Arrays
9.1.2 Instantiating Multidimensional Arrays
9.1.3 Combining the Declaration and
Instantiation of Multidimensional
Arrays
9.1.4 Assigning Initial Values to
Multidimensional Arrays
9.2 Accessing Multidimensional Array Elements
9.3 Aggregate Two-Dimensional Array
Operations
9.3.1 Processing All the Elements of a Two-
Dimensional Array
9.3.2 Processing a Given Row of a Two-
Dimensional Array
9.3.3 Processing a Given Column of a Two-
Dimensional Array
9.3.4 Processing a Two-Dimensional Array
One Row at a Time
9.3.5 Processing a Two-Dimensional Array
One Column at a Time
9.3.6 Displaying Two-Dimensional Array
Data as a Bar Chart
9.4 Two-Dimensional Arrays Passed to and
Returned from Methods
9.5 Programming Activity 1: Working with Two-
Dimensional Arrays
Instructions
Troubleshooting
9.6 Other Multidimensional Arrays
9.7 The ArrayList Class
9.7.1 Declaring and Instantiating
ArrayList Objects
9.7.2 Methods of the ArrayList Class
9.7.3 Looping Through an ArrayList Using
an Enhanced for Loop
9.7.4 Using the ArrayList Class in a
Program
9.8 Programming Activity 2: Working with the
ArrayList Class
Instructions
Troubleshooting
9.9 Chapter Summary
9.10 Exercises, Problems, and Projects
9.10.1 Multiple Choice Exercises
9.10.2 Reading and Understanding Code
9.10.3 Fill In the Code
9.10.4 Identifying Errors in Code
9.10.5 Debugging Area—Using Messages
from the Java Compiler and Java
JVM
9.10.6 Write a Short Program
9.10.7 Programming Projects
9.10.8 Technical Writing
9.10.9 Group Project (for a group of 1, 2, or
3 students)
Chapter 10 Object-Oriented Programming, Part
3: Inheritance, Polymorphism, and
Interfaces
10.1 Inheritance
10.2 Inheritance Design
10.2.1 Inherited Members of a Class
10.2.2 Subclass Constructors
10.2.3 Adding Specialization to the
Subclass
10.2.4 Overriding Inherited Methods
10.3 The protected Access Modifier
10.4 Programming Activity 1: Using Inheritance
Instructions
10.5 Abstract Classes and Methods
10.6 Polymorphism
10.7 Programming Activity 2: Using
Polymorphism
Instructions
10.8 Interfaces
10.9 Chapter Summary
10.10 Exercises, Problems, and Projects
10.10.1 Multiple Choice Exercises
10.10.2 Reading and Understanding Code
10.10.3 Fill In the Code
10.10.4 Identifying Errors in Code
10.10.5 Debugging Area—Using
Messages from the Java Compiler
and Java JVM
10.10.6 Write a Short Program
10.10.7 Programming Projects
10.10.8 Technical Writing
10.10.9 Group Project (for a group of 1, 2,
or 3 students)
Chapter 11 Exceptions and Input/Output
Operations
11.1 Simple Exception Handling
11.2 Catching Multiple Exceptions
11.3 Reading Text Files Using Scanner
11.4 The java.io Package
11.5 Recovering from an Exception
11.6 Writing and Appending to Text Files
11.6.1 Writing to Text Files
11.6.2 Appending to Text Files
11.7 Reading Structured Text Files
11.7.1 Parsing a String Using Scanner
11.7.2 Reading Structured Data Using
Scanner
11.8 Programming Activity 1: Reading from a
Structured Text File
Instructions
If you have time …
Troubleshooting
11.9 Streams
11.10 Reading Formatted Open Data from a
Remote Location
11.10.1 Accessing Remote Data
11.10.2 JSON Formatting and Parsing
11.10.3 Reading, Parsing, Streaming, and
Processing Remote Data
11.11 Reading and Writing Objects to a File
11.11.1 Writing Objects to Files
11.11.2 Reading Objects from Files
11.12 Programming Activity 2: Reading Objects
from a File
Task Instructions: Reading from
the transactions.obj File
If you have time …
Troubleshooting
11.13 User-Defined Exceptions
11.14 Chapter Summary
11.15 Exercises, Problems, and Projects
11.15.1 Multiple Choice Exercises
11.15.2 Reading and Understanding Code
11.15.3 Fill In the Code
11.15.4 Identifying Errors in Code
11.15.5 Debugging Area—Using
Messages from the Java Compiler
and Java JVM
11.15.6 Write a Short Program
11.15.7 Programming Projects
11.15.8 Technical Writing
11.15.9 Group Project (for groups of 2, 3,
or more students)
Chapter 12 Graphical User Interfaces Using
JavaFX
12.1 The Structure of a JavaFX Application
12.2 GUI Controls
12.3 A Simple Control: Label
12.4 Event Handling: Managing User
Interactions
12.5 Text Fields and Command Buttons
12.6 Radio Buttons and Checkboxes
12.7 Programming Activity 1: Working with
Buttons
Instructions
Troubleshooting
12.8 Combo Boxes
12.9 Sliders
12.10 Building a GUI Programmatically
12.11 Layout Containers: Dynamically Setting Up
the GUI Using GridPane
12.12 BorderPane Layout, Animations, Sounds,
and Lambda Expressions
12.13 Nesting Components
12.14 Mouse and Touch Events
12.15 Using a List to Display a Pie Chart
12.16 Using a List to Display a Dynamic Bar
Chart
12.17 Using a Style Sheet to Style the View
12.18 Programming Activity 2: Working with
Layout Containers
Instructions
12.19 Chapter Summary
12.20 Exercises, Problems, and Projects
12.20.1 Multiple Choice Exercises
12.20.2 Reading and Understanding Code
12.20.3 Fill In the Code
12.20.4 Identifying Errors in Code
12.20.5 Debugging Area—Using
Messages from the Java Compiler
and Java JVM
12.20.6 Write a Short Program
12.20.7 Programming Projects
12.20.8 Technical Writing
12.20.9 Group Project (for a group of 1, 2,
or 3 students)
Chapter 13 Recursion
13.1 Simple Recursion: Identifying the General
and Base Cases
13.2 Recursion with a Return Value
13.2.1 Computing the Factorial of a
Number
13.2.2 Computing the Greatest Common
Divisor
13.3 Recursion with Two Base Cases
13.4 Programming Activity 1: Checking for a
Palindrome
Instructions
Task Instructions
Troubleshooting
13.5 Binary Search: A Recursive Solution
13.6 Programming Activity 2: The Towers of
Hanoi
Instructions
Task Instructions
Troubleshooting
13.7 Recursion Versus Iteration
13.8 Chapter Summary
13.9 Exercises, Problems, and Projects
13.9.1 Multiple Choice Exercises
13.9.2 Reading and Understanding Code
13.9.3 Fill In the Code
13.9.4 Identifying Errors in Code
13.9.5 Debugging Area—Using Messages
from the Java Compiler and Java
JVM
13.9.6 Write a Short Program
13.9.7 Programming Projects
13.9.8 Technical Writing
13.9.9 Group Projects (for a group of 1, 2,
or 3 students)
Chapter 14 An Introduction to Data Structures
14.1 Linked Lists
14.1.1 Linked-List Concepts and Structure
14.1.2 Linked-List Basics
14.1.3 Methods of a Linked List
14.1.4 Testing a Linked-List Class
14.2 Linked Lists of Objects
14.2.1 A Linked-List Shell
14.2.2 Generating an Exception
14.2.3 Other Methods of a Linked List
14.2.4 Testing a Linked-List Class
14.3 Implementing a Stack Using a Linked List
14.4 Implementing a Queue Using a Linked List
14.5 Array Representation of Stacks
14.6 Programming Activity 1: Writing Methods
for a Stack Class
Instructions
Troubleshooting
14.7 Array Representation of Queues
14.8 Sorted Linked Lists
14.9 Programming Activity 2: Writing Insert and
Delete Methods for a Sorted Linked List
Instructions
Troubleshooting
14.10 Doubly Linked Lists
14.11 Linked Lists Using Generic Types
14.12 Recursively Defined Linked Lists
14.13 Chapter Summary
14.14 Exercises, Problems, and Projects
14.14.1 Multiple Choice Exercises
14.14.2 Reading and Understanding Code
14.14.3 Fill In the Code
14.14.4 Identifying Errors in Code
14.14.5 Debugging Area—Using
Messages from the Java Compiler
and Java JVM
14.14.6 Write a Short Program
14.14.7 Programming Projects
14.14.8 Technical Writing
14.14.9 Group Project (for a group of 1, 2,
or 3 students)
Chapter 15 Running Time Analysis
15.1 Orders of Magnitude and Big-Oh Notation
15.2 Running Time Analysis of Algorithms:
Counting Statements
15.3 Running Time Analysis of Algorithms and
Impact of Coding: Evaluating Recursive
Methods
Handwaving Method
Iterative Method
Proof by Induction Method
Other Methods
15.4 Programming Activity: Tracking How Many
Statements Are Executed by a Method
Instructions
Troubleshooting
15.5 Running Time Analysis of Searching and
Sorting Algorithms
15.6 Chapter Summary
15.7 Exercises, Problems, and Projects
15.7.1 Multiple Choice Exercises
15.7.2 Compute the Running Time of a
Method
15.7.3 Programming Projects
15.7.4 Technical Writing
15.7.5 Group Project (for a group of 1, 2,
or 3 students)
Appendix A Java Reserved Words and
Keywords
Appendix B Operator Precedence
Appendix C The Unicode Character Set
Appendix D Representing Negative Integers
Appendix E Representing Floating-Point
Numbers
Appendix F Solutions to Selected Exercises
Index
Preface
Purpose of This Text and Its Audience
Java Illuminated, Fifth Edition, covers all of the material
required for the successful completion of an introductory
course in Java. While the focus is on the material required for
the Computer Science I (CS1) and Computer Science II (CS2)
curricula, students enrolled in Information Systems,
Information Technology, or self-directed study courses will find
the text useful as well. It has been written to provide
introductory computer science students with a comprehensive
overview of the fundamentals of programming using Java as
the teaching language. In addition, the text presents other
topics of interest, including graphical user interfaces (GUI),
data structures, file input and output, and graphical
applications.
Throughout the text, we take an “active learning” approach to
presenting the material. Instead of merely presenting the
concepts to students in a one-sided, rote manner, we ask
them to take an active role in their understanding of the
concepts through the use of numerous interactive examples,
exercises, and projects.
Coverage and Approach
Our approach is to teach object-oriented programming in a
progressive manner. We start in Chapter 1 by presenting an
overview of object-oriented programming. In Chapter 3, we
delve a little deeper into the concepts of classes and objects
and introduce the student to many of the useful classes in the
Java Class Library. Our emphasis at this point is on using
classes; we teach the student how to read APIs in order to
determine how to instantiate objects and call methods of the
classes. In Chapter 7, we move on to designing user-defined
classes, and in Chapter 10, we present inheritance,
polymorphism, and interfaces. Throughout the text, we
present concepts in an object-oriented context.
Our philosophy is to emphasize good software engineering
practices by focusing on designing and writing correct,
maintainable programs. As such, we discuss pseudocode,
testing techniques, design trade-offs, and other software
engineering tips.
We teach the student basic programming techniques, such as
accumulation, counting, calculating an average, finding
maximum and minimum values, using flag and toggle
variables, and basic searching and sorting algorithms. In
doing so, we emphasize the patterns inherent in
programming. Concepts are taught first, followed by fully
implemented examples with source code. We promote Java
standards, conventions, and methodologies.
What’s New in Java Illuminated
In this edition, we have incorporated the latest features of
Java in Java 8 and Java 9: the jshell sandbox, Streams,
functional interfaces and lambda expressions, the use of
default methods in interfaces, JavaFX graphics, using FXML
in JavaFX applications, tying a JavaFX GUI component to
data in a Collection, JavaFX animations, and the StackWalker
class. We have converted all graphics examples and
graphical Programming Activities to JavaFX.
Throughout the book, we updated, improved, and replaced
examples.
In Chapter 1, we added instructions for making a JAR file.
In Chapter 2, we use the Java 9 jshell sandbox to
demonstrate the definition of variables, assigning of values to
variables, and the results of performing arithmetic
calculations.
In Chapter 3, we augmented the existing example on Strings
with more explanations of Strings methods, and added
another example with illustrations to demonstrate Strings
Processing techniques. In both examples, we emphasize
sending arguments to methods and receiving return values.
We converted Chapter 4 to JavaFX. To make it easier for the
students to write JavaFX applications, we provide a utility
class that encapsulates the overhead code to create a
window. As a result, the students can concentrate on calling
methods of the GraphicsContext class. We provide an online
version of the Swing version of Chapter 4 from the 4th edition
for those instructors who prefer the Swing graphics system.
In Chapter 7, we modified mutator methods to change
instance variable values only if the parameter value is valid.
Otherwise, the instance variable value is unchanged and we
no longer output an error message. After we introduce the
implicit reference, this, we implement the standard Java
coding style of defining parameters with the same name as
the instance variable. Further, we allow mutator methods to
be chained by returning a reference to the object being
modified. We have also moved the material on creating
packages to an online supplement.
In Chapter 10, we converted the polymorphism example to
JavaFX. We revised our existing interface example to use a
default method and added an example demonstrating
polymorphism with interfaces.
In Chapter 11, we added sections showing how to read file
data into a Stream, and then filter and process that Stream
using lambda expressions. We also added an example that
reads and parses JSON data from a remote location on the
Internet.
We converted Chapter 12 from Swing to JavaFX (the Swing
version of Chapter 12 from the Fourth Edition is now available
online). We added how to define a View using FXML, as well
as programmatically, how to process touches, how to tie a
GUI component to a Collection so that it is automatically
updated as the data changes using ObservableLists, how to
play sounds, and how to perform animations using JavaFX.
We explain how to write event handlers using lambda
expressions.
In Chapter 13, we use the StackWalker class to illustrate the
state of the stack as recursive calls are made.
Learning Features
Recognizing today’s students’ growing interest in
visualization, we distribute techniques for producing graphical
output throughout the book, starting in Chapter 4 with
graphical applications. An example using either animation or
graphical output is included in most chapters. Instructors who
are not interested in incorporating graphics into their
curriculum can simply skip these sections. In addition, some
of our examples are small games, which we find motivational
for students.
In each chapter, we include one or two Programming
Activities, which are designed to provide visual feedback to
the students so that they can assess the correctness of their
code. In most Programming Activities, we provide a
framework, usually with a graphical user interface, to which
the student adds code to complete the application. The
student should be able to finish the Programming Activity in
about 15 to 20 minutes; thus, these activities can be used in
the classroom to reinforce the topics just presented. Each
Programming Activity also includes several discussion
questions that test the student’s understanding of the
concepts the activity illustrates. The Programming Activities
are also appropriate for a closed or open laboratory
environment. In short, this text can be used in a traditional
lecture environment, a computer-equipped classroom, or a lab
environment.
In addition, we supplement each chapter with a browser-
based module that animates sample code, visually illustrating
concepts such as the assignment of variable values,
evaluation of conditions, and flow of control.
We also provide the instructor and students with an extensive
variety of end-of-chapter material: multiple-choice questions,
examples that ask the student to predict the output of
prewritten code or to fill in missing code, debugging activities,
short exercises, programming projects, technical writing
assignments, one or more learning-to-learn exercises called
Look It Up, and a higher-difficulty group project.
Chapter-by-Chapter Overview
The chapters are logically organized from simple to more
difficult topics, while incorporating object orientation as
needed, taking into account the specifics of the Java
language. Here is a brief summary of the topics covered in
each chapter:
Chapter 1: Introduction to Programming
and the Java Language
We introduce the student to the concept of programming, first
covering computer hardware and operating systems, and
following with a brief evolution of programming languages,
including an introduction to object-oriented programming. We
explain programming basics and pseudocode as a program
design technique. The student writes, compiles, and debugs
their first program using an integrated development
environment.
Chapter 2: Programming Building
Blocks—Java Basics
In this chapter, we concentrate on working with variables and
constants of primitive data types and composing arithmetic
expressions. We illustrate the differences between integer and
floating-point calculations and introduce operator precedence.
We introduce jshell, the programming sandbox now available
with Java 9. We use a combination of jshell sessions and
complete programs to demonstrate the concepts at hand.
Chapter 3: Object-Oriented
Programming, Part 1: Using Classes
Chapter 3 introduces classes from the user, or client,
standpoint and discusses the benefits of encapsulation and
code reuse. The student learns how to instantiate objects and
call methods. We also demonstrate useful Java classes for
console input and output, formatting output, performing
mathematical calculations, generating random numbers, and
using methods of the Wrapper classes. We use methods of
the String class to visually illustrate the passing of arguments
and receiving of and use of return values.
Chapter 4: Introduction to Graphical
Applications
Chapter 4 presents several methods of the JavaFX
GraphicsContext class that can be used to create graphical
output by drawing shapes, text, and sprites. The windowing
graphics coordinate system is explained and using color is
also explored. We demonstrate these graphics methods in
JavaFX applications. Instructors wishing to postpone or skip
graphics coverage altogether can use as little or as much of
this chapter as they desire.
Chapter 5: Flow of Control, Part 1:
Selection
Various forms of the if, if/else, and if/else if statements are
presented, along with the appropriate situations in which to
use each form. We also demonstrate nested if/else
statements and testing techniques. We begin our coverage of
scope by introducing block scope. Later chapters build upon
this foundation. As part of our object-oriented programming
coverage, we teach the importance of comparing objects
using the equals method. This chapter also covers the
conditional operator and the switch statement.
Chapter 6: Flow of Control, Part 2:
Looping
This is probably the most important chapter in the book. We
have found that looping and repetition are the most difficult
basic programming concepts for the average student to grasp.
We try to ease the student’s understanding of looping
techniques by presenting patterns to follow in coding basic
algorithms: accumulation, counting, calculating an average,
and finding minimum and maximum values. Looping is further
explored as a tool for validation of input values. We also
introduce toggle variables and flag variables as tools to
facilitate writing loops. We continue our coverage of scope by
illustrating the scope of variables declared within the while
loop body and for loop header. We concentrate on using the
while loop for event-controlled and sentinel-controlled
repetition and the for loop for count-controlled looping. A large
section focuses on constructing loop conditions, which is often
a challenging task for the student. Sections are also provided
on testing techniques for loops. In this chapter, we also
introduce reading data from a text file using the Scanner
class.
Chapter 7: Object-Oriented
Programming, Part 2: User-Defined
Classes
In this chapter, we teach the student to write classes, as well
as client applications that instantiate objects and call methods
of the class. We present class design techniques and
standard patterns for writing constructors, mutators and
accessors, and the toString, equals, and other user-defined
methods. We further explain scope in the context of class
members and method parameters. We also explain how to
write classes with static methods and static data. Additionally,
we illustrate how to write methods so that the method calls
can be chained. Enum is also covered as a user-defined class
type. Finally, we teach the student how to use Javadoc.
Chapter 8: Single-Dimensional Arrays
This chapter begins with the declaration, instantiation, and
initialization of single-dimensional arrays. From there, the
student learns to perform the basic programming techniques
(accumulation, counting, calculating an average, and finding
maximum and minimum values) on array elements. We also
cover arrays as instance variables of a class, and
demonstrate maintaining encapsulation while accepting
arrays as method parameters and returning arrays from
methods. We demonstrate how to represent an array as a bar
chart. Basic searching and sorting algorithms are also
presented, including sequential and binary searches and
Selection and Insertion sorts.
Chapter 9: Multidimensional Arrays and
the ArrayList Class
We focus in this chapter on two-dimensional array processing,
including techniques for processing the elements in the entire
array, or the elements in a specific column or row. We also
demonstrate the extra processing needed to handle arrays
with rows of different lengths. Creating a bar chart of the data
in the array is also demonstrated. In addition, we extrapolate
the concepts from two-dimensional arrays to discuss
multidimensional arrays.
We present the ArrayList class as an expandable array and
demonstrate using classes with generic types, the enhanced
for loop, and autoboxing and unboxing.
Chapter 10: Object-Oriented
Programming, Part 3: Inheritance,
Polymorphism, and Interfaces
Continuing our object-oriented programming coverage, we
discuss the important concepts and benefits of inheritance
and the design of class hierarchies, including abstract
classes. We cover inherited members of a class, constructing
objects of a subclass, adding specialization to a subclass,
overriding inherited methods, and calling methods of the
superclass. We discuss the trade-offs of declaring members
as protected versus private. We demonstrate polymorphism
with a graphical example. We introduce the student to
interfaces, emphasizing code reuse as the motivation for
defining interfaces. We explain default methods and how we
can use them in new versions of a program so that our old
code does not break as we add new features. We also
demonstrate polymorphism using interfaces. Interfaces are
used extensively in Graphical User Interfaces (See Chapter
12.) We introduce UML diagrams to help students visualize
the inheritance hierarchy of the examples.
Chapter 11: Exceptions and Input/Output
Operations
Recognizing that building robust applications requires error
handling, we present exception handling as a tool for
validating user input and recovering from errors at run time.
We demonstrate handling predefined exceptions and writing
user-defined exceptions.
With this knowledge, the student is ready to perform file input
and output operations. We demonstrate reading and writing
Strings and primitive data types to text files, and reading and
writing objects directly to files. The Scanner class is used to
read and parse input from text files and Strings. We
demonstrate how to read and place file contents into a Stream
and how to filter and process that Stream. We use lambda
expressions when processing the Stream. We demonstrate
how to read data from a remote file located on the Internet,
including parsing JSON data and converting that data into a
Stream for filtering and processing.
Chapter 12: Graphical User Interfaces
Using JavaFX
This chapter introduces the student to event-driven
programming and writing event handlers for text fields,
buttons, radio buttons, checkboxes, combo boxes, sliders,
and mouse and touch activities. We also demonstrate panels
and several layout managers for organizing GUI components,
as well as how to nest components. In our examples, we
illustrate how to separate the graphical user interface code
from the underlying data and program logic using the Model-
View-Controller architecture. We demonstrate how to use
FXML to define a View, and we also show how we can define
a View programmatically. Showing bar charts and pie charts,
we demonstrate how we can use Collections with JavaFX
components so that the GUI is automatically updated when its
model (a Collection) is changed. We explain how to write
lambda expressions and use them throughout the chapter.
We demonstrate how we can use the various animation
classes of JavaFX to animate a sprite, including performing
sequential and parallel animations.
Chapter 13: Recursion
Recursion is presented as a design technique, reducing the
size of a problem until an easy-to-solve problem is reached.
We demonstrate recursive methods with one base case and
with multiple base cases, and with and without return values.
Specific examples provided include computing the factorial of
a number, finding the greatest common divisor, performing a
binary search, determining if a phrase is a palindrome,
calculating combinations, and solving the Towers of Hanoi
problem. We use the StackWalker class to demonstrate how
values are pushed onto and popped off the stack as recursive
calls are executed. The benefits and trade-offs of recursion
versus iteration are also discussed.
Chapter 14: An Introduction to Data
Structures
In this chapter, we cover data structures by exploring the
concepts and implementations of various types of linked lists,
stacks, and queues. We demonstrate many types and uses of
linked lists: a singly linked list, a linked list as a stack, a linked
list as a queue, a doubly linked list, a sorted linked list, and a
recursively defined linked list. Arrays as stacks and circular
arrays as queues are also covered in detail.
We begin with a list of primitive types (int) and progress to a
list consisting of objects of a user-defined Player class. Then
we cover defining a class using generic types to demonstrate
how a list can be defined to hold generic objects.
Chapter 15: Running Time Analysis
We explain how to evaluate the performance of an algorithm
in this chapter. We explain the Big-Oh notation and orders of
magnitude. Students learn various methods for deriving
performance estimates: counting statements in loops,
iterative, handwaving, and proof by induction analyses for
recursive methods. We demonstrate how the coding of an
algorithm influences its running time. Worst-case, best-case,
and average-case performances are explained and illustrated.
Discovering Diverse Content Through
Random Scribd Documents
CHAPTER XVI
SAINT MARTIN'S SUMMER
One of the quiet evenings, the two men were playing chess and
Daffodil was watching them; Susan came in and said in her most
respectful manner:
"A gentleman wishes to see Miss Carrick. Here is his card."
Daffodil took it and read, "Archibald Langdale, M.D."
"Oh," in a glad, girlish tone, "it's my old friend, Archie, that I haven't
seen in ever so long. Dr. Langdale;" with a pretty assumption of
dignity.
"Yes."
"And, uncle, you must see him. Not that I want you to accept him
for a family physician, for really I don't know what he is like. He may
be the veriest prig;" and she gave a dainty half laugh. "If he is
spoiled it will be the fault of your city, he was very nice at Pittsburg.
And you, too, Mr. Bartram."
"I have met the young man. I didn't see that he was much puffed up
with his honors."
"Thank you." She made a fascinating courtesy. How pleased she
was, he could see that.
"We will soon be through with the game. Yes, I'll come," said M. de
Ronville.
She would hardly have known Archie. He stood up straight and he
was quite as tall as Ned. He had filled out somewhat, though he was
still rather thin, but his face had lost that deprecating expression,
and had a clear notion not only of truth and honor, but of his own
power as well. It was a tender face also, with the light in it that
draws one unconsciously. The eyes seemed to have grown darker,
but the hair was light as in boyhood.
"I am so glad to see you again;" and he took both hands in a warm
clasp. "I couldn't wait until some accidental meeting, where you
might kindly invite me for old friendship's sake."
"That would not have been worth while. I have heard about you,
and I wondered if you had outgrown childish remembrances."
"You would bring them all back if I had. How little you have
changed, except to grow tall. And now tell me about yours and
mine. Once in a great while Ned writes, and mother doesn't seem to
have the gift of chatty letters. Hers are mostly about my humble self,
her son rather, and how he must avoid certain things and do other
certain things, and not grow hard-hearted and irreligious and
careless of his health;" smiling with a touch of tenderness. "So, you
see, I do not hear much about the real Pittsburg."
"Oh, you would hardly know it now, there are so many changes, and
so much business. New streets, instead of the old lanes, and the old
log houses are fast disappearing. We are making real glass, you
know, and there is talk of a paper mill. And nearly all the girls are
married; the older ones, I mean. Families are coming in from the
country, others go out to Ohio and Kentucky. Why, it is a whirl all the
time."
"I'd like to see it and mother. I've planned to go several times, but
some study or lectures that I couldn't miss would crop up. And it
takes so much time. Why doesn't some one invent a quicker way of
travelling? Now, if we could fly."
"Oh, that would be just splendid!" eagerly.
"I used to watch the birds when I was a boy, and flying seemed so
easy for them. Now, why can't some one think up a pair of wings
that you could slip on like a jacket and work them with some sort of
springs, and go sailing off? I'm learning to put people together, but I
never was any hand for machinery."
"Oh, think of it! A winged jacket;" and they both laughed gleefully.
Then M. de Ronville entered and expressed his pleasure at meeting
the young man, who was already distinguishing himself, and who
was an old friend of Miss Carrick.
"Not that either of you are very old," he commented smilingly.
Mr. Bartram he recalled. And certainly the generally quiet student
talked his best. Was Daffodil a sort of inspiration? Was that one of
the graces of early friendship?
He apologized presently for his long stay. He so seldom made calls,
that he must plead ignorance of the correct length, but he had
enjoyed himself very much. And then M. de Ronville invited him to
drop in to tea. He would like to discuss some new medical methods
with him.
"A very intelligent, well-balanced young man," the host remarked. "If
the other one is as sensible, they are sons to be proud of."
"Their mother is proud of them, but their father would rather have
had them in business," said Daffodil.
Belinda Pemberton was quite fascinated with Daffodil. "You are such
a sweet, quaint, honest little thing," she said, "and you do make
such delightfully naïve remarks. And Arthur declares you must have
learned to dance in fairyland."
"I think I did," she returned gayly. "And I do love it so."
Then the little circle, and the wider one, had a fine surprise. Betty
Wharton, now Madame Clerval, returned quite unexpectedly, as her
husband had resigned his position.
"I had quite enough of Paris," she said to a friend. "One wants an
immense fortune to truly enjoy it. And somehow things seem shaky.
Then, too, one does have a longing for home when one gets past
youth."
So she opened her house and set up a carriage. Monsieur Clerval
found himself quite in demand by the government, as the country
needed a multitude of counsellors.
She came in to see M. de Ronville, who gallantly said she had
renewed her youth, and begged for the secret.
"It is simply to keep young, to resolve not to grow old;" with a gay
emphasis.
"But time passes, my dear lady."
"And where is that pretty, golden-haired Daffodil?" she enquired.
The girl was summoned. Yes, she had outgrown childhood, but there
was a delightful charm in her young womanhood.
"We were such friends—if you can remember so far back."
"And you were so good to me, and made everything so enjoyable.
Wasn't I very ignorant?"
"You were very frank, and honest, and adaptable. So we must take
up the old intimacy again. M. de Ronville, I shall drop in often and
say, 'Lend me your daughter for this or that occasion.' Or is it your
niece? And if some one falls in love with her you must not scold me.
Young men have eyes, and really, I am too kindly-hearted to throw
dust in them."
Daffodil turned scarlet.
"Is it quite right to go about so much?" she said to M. de Ronville
afterward, and the tone had a great uncertainty in it, while the
curves of her pretty mouth quivered. "For you know——"
He drew her down beside him on the sofa.
"I thought some time we would talk it over—your unfortunate
marriage, I suppose, comes up now and then to haunt you. Yet, it
was fortunate, too, that the explanation came just as it did. I
honestly believe it was an ignorant child's fancy. You were not old
enough to understand real love. I think he could hardly have been a
thorough villain, but an incident like this has happened more than
once. And I truly believe you have overlived it."
She shuddered, and her eyes were limpid with tears. It was good to
feel his friendly arm about her.
"It is like a dream to me, most of the time. And I think now, if he
had made a passionate, despairing protest, it would have gone much
harder with me. But it was right for him to go away when his father
sent, and he was the next in succession to Hurst Abbey. And there
was his child, his boy. I could never have been his true wife, but it
hurt to be given up so readily, yet it was best. It gave me courage.
And what if he had tired of me later on? They all helped me to bear
it. And there was the deception. For if he had told the truth, there
might have been pity, but no love."
"It was a sad thing to happen. My heart ached for you. But you
know, Daffodil, you never were a wife in the true sense of the word.
You are quite free, you have always been free. And you must feel so.
You must not carry about with you any uncertainty. It is something
buried fathoms deep, that you need never draw up to the surface,
unless in time to come you tell the story to the man you marry."
"I shall never marry," she returned gravely. "I have it all planned.
Felix shall have the fortune, for what could a woman do with it in
her own hands? And he has the name, he has only to leave off the
Carrick. And it shall be my business to make every one as happy as I
can. And if it is not wrong to take pleasure for myself—I do love joy
and happiness, and I could not grieve forever, when I knew the
thing I would grieve for was wrong."
There were tears dropping off the bronze lashes, but she was not
really crying. He pressed her closer. There was an exquisite depth to
her that did not often come to the surface.
"So you have it all planned for the years to come," he returned after
a moment or two. "That is quite far off. Meanwhile you must have a
good time with other young people. That will make me the happiest,
if you care for me."
"Oh, indeed I do, indeed I do," she cried earnestly. Then, after quite
a pause, she continued—
"I almost lost sight of what I wanted to ask. It was whether I ought
to explain anything, whether it would be sailing under false colors
when no one knew;" and she gave a tangled sort of breath that she
would not allow to break into a sob.
"My dear child, there would be no use in explaining what could only
be a matter of gossip. I think, nay, I am certain, Aldis and myself are
the only ones who know, and if there had been any trouble I should
have sent him to your assistance. I dare say, some of your friends
and neighbors at home have wellnigh forgotten about it. And now,
do not let it disturb you, but be as happy as God meant you should
be, when He snatched you from the peril."
"Oh, thank you," she rejoined with a grateful emotion that he felt
quiver through her slender body.
She wondered if she was too light-minded, too easily pleased. For
every joyous thing seemed to come her way. The girls sought her
out, the young men wanted to dance with her, and were willing to
bore themselves going out to supper, if they knew she would be
there. It was not because she was brighter or wittier than the
others, or could think of more entertaining plays, but just that she
seemed to radiate an atmosphere of happiness.
She did not give up all her time to pleasure. She drove with her
guardian on pleasant days; he had left off riding now, but he sent
her out occasionally with Mr. Bartram, lest she should get out of
practice, he said. Then she read to him, or they took up French. She
made merry over her blunders.
The autumn was long and warm. They sat in the garden in the
sunshine, or walked up and down. Now and then he went to the
office, when there were some important matters on hand.
Madame Clerval gave a dance after she had her house set in order.
It might have been called a ball. It was mostly for the young people;
she was just as fond of them as ever, and secretly admitted that she
didn't enjoy prosy old people, who could talk of nothing but their
pains and aches, and how fast the country was going to ruin.
"Do you think Mr. Bartram would consider it a nuisance to come for
me?" she asked of her guardian, with a face like a peony.
"Why, no, child. Madame made quite a point of his coming. He is
growing old too fast."
"Why, he isn't old," she said rather indignantly. "And you see—it's
hard sometimes not to offend this one or that one, and if he is really
coming, will you ask him to bring me home? Wouldn't you prefer it?"
"I think I would;" very gravely, though he wanted to smile.
Wetherell and Arthur Pemberton were pushing each other for her
favors, and she tried to distribute them impartially.
The dance was a splendid success, and the dainty supper had a
French air. Mr. Bartram came in just before that. Daffodil was
engaged, of course. Madame provided him with a charming partner.
There was only a galop afterward. At private affairs it was not
considered good taste to stay after midnight. Mr. Bartram made his
way to Daffodil, and asked her if she was ready to go, and she
nodded gracefully.
She looked so pretty as she came down the stairs, wrapped in
something white and fleecy, smiling on this side and that.
"It was very enjoyable," he said, "at least to you young people. I'm
not much of a dancer nowadays, so I didn't come early."
"It was just full of pleasure. Madame Clerval always plans
admirably."
He smiled to himself. Most girls would have protested about his
being late, even if they had not specially cared.
The young people took up the habit of calling in the evening, three
or four of them, sometimes half a dozen. Mrs. Jarvis would send in
some cake and nice home-made wine, which was quite a fashion
then. They made merry, of course.
"Dear uncle," she said one morning, it was raining so they couldn't
go out, "didn't we disturb you last evening with our noise and
laughter? I don't know why they are so eager to come here, and
think they have a good time, for I am not as full of bright sayings as
some of the girls. And if it annoys you——"
"My child, no. I lay on the sofa and listened to it, and it almost made
me young again. I had no merry youth like that. Oh, am I coming to
second childhood?"
His eyes were bright, and she thought she had never seen them so
merry, save at first, when he had laughed at some of Felix's pranks.
And his complexion was less pallid, his lips were red.
"Then second childhood is lovely. And you have grown so interested
in everything. You don't get tired as you used. Are you real happy, or
are you doing it just to make me happy?"
She gave him such a sweet, enquiring look, that he was touched at
her solicitude.
"It is both, I fancy. You see, last winter I was ill and alone a great
deal. I missed Betty Wharton, who was always flying in with some
fun, or a bright story that had been told. Aldis had all the business
to attend to, and sometimes wrote in the evenings. Time hung very
heavy on my hands, and I began to think it was time for me to go
hence. And by spring I had quite lost heart, though I began to crawl
about a little. And I kept thinking how I should live through another
dreary winter, and be half sick. It kept looming up before me. Then I
thought I ought to settle something about your business when your
father wrote concerning the lease. You came into my mind. I
thought how brave you had been through that unfortunate time, and
wondered if you would not like a change. I wanted some one to
bring in the sunshine of youth, and you had spent so many of your
years with elderly people, I thought you must have some art. I could
make it pleasant for you, and the reflected light would brighten me.
So I begged a little of your sweet young life."
"I am glad if it has made you happy," she said, much moved.
"It has given me new zest, it has made me almost well. True, I have
had some twinges of my old enemy, rheumatism, but they have not
been severe. I have not been lonely. There was some pleasure
within my reach all the time. Oh, old people do want a little of the
sun of youth to shine on them. And if you had no dear ones at
home, I should keep you always, golden-haired Daffodil."
She took his hand in hers, so full of fresh young life. "And I should
stay," she said.
"So, do not think your little merry-makings annoy me at all. I am
glad for you to have them, and next day it is like reading a page out
of a book, a human book that we are apt to pass by, and say we
have no pleasure in it, but it is what we need, and what we want,
down in our very heart of hearts, but often we are ashamed to ask
for it."
It was true, he was much better. The house was losing its grave
aspect. Jane had been used to flinging about wise old saws, and
comparisons, and finding things to enjoy; Susan was quiet, falling
into routine, and staying there until some new duty fairly pushed her
out in another direction. She had no sense of humor or enthusiasm,
yet she performed all the requirements of her place with ease and
industry.
Mrs. Jarvis was just as kindly solicitous as ever, but intellectually
there was a great gulf between her and M. de Ronville. She
entertained whatever guests came with an air of precision, never
forgetting she was a higher sort of housekeeper. She enjoyed the
quiet of her own room, where she sewed a little, and read a good
deal, the old-fashioned English novels, such as "Children of the
Abbey," "Mysterious Marriage," "The Cottage on the Cliff," and
stories of the latter half of the century. She thought it no part of a
woman's business to concern herself with politics, she would have
preferred living under a real King and nobility, but she accepted the
powers that ruled, and stayed in her own little world, though she, as
well as M. de Ronville, enjoyed the stir and interest that Daffodil
brought about.
After Madame Clerval came, there was more variety and gayety in
Daffodil's life, and she helped to rouse M. de Ronville as well. Then
came a reception at the Presidential mansion.
"Of course, you will go," Madame said to him, in her persuasive, yet
imperious, manner. "We must not be a whit behind those New York
people in the attention we pay our President. And one need not stay
the whole evening through, you know. You will meet so many old
friends. Come, I cannot have you getting old before your time."
"But I am an old man," he protested.
"In our new country we must not get old. It is to be the land of
perennial youth," she answered gayly.
Aldis Bartram joined his persuasions as well, and M. de Ronville went
almost in spite of himself. He had kept his delicate, high-bred air and
French atmosphere, and looked well in the attire of that day, with his
flowered waistcoat, his black velvet suit and silk stockings, with a
jewelled buckle on his low shoes. His beautiful white hair was just
tied in a queue, with a black ribbon. There was something dignified
and gracious about him, and friends thronged around to
congratulate him. And though he had seen Washington in many
different phases of his eventful life, he had not as yet met him as
President of the nation he had fought for and cemented together.
There were handsomer girls than Daffodil; indeed, the fame of the
beauties of Philadelphia in that day has been the theme of many a
song and story. But she was very pretty in her simple white frock
that in the fashion of the day showed her exquisite neck and
shoulders, though the golden curls, tied high on her head, shaded
and dazzled about it in a most bewitching manner. Madame Clerval
was wise, she was not trying to outshine any of the belles, yet there
was a bevy of young men about her constantly, and most devoted to
her and to M. de Ronville, was Dr. Langdale. In fact, he was really
the favorite visitor at the house. He ran in now and then with news
of some new book, or some old translation, and a talk of the
progress of the library and the trend of general education. Why
should Boston have it all? Or a new medical discovery, though he
was in no sense M. de Ronville's physician.
Was it strange that both these young people, having passed their
childhood in Pittsburg, should come to a nearer and dearer
understanding? Aldis Bartram watched them with the sense of a new
revelation. Yet he could not subscribe to it cordially. The medical
enthusiast was hardly the one he would choose for a girl like
Daffodil. Arthur Pemberton would do better, yet he was not quite up
to her mark. She was a simple seeming girl, yet he was learning that
she had a great deal of character and sweetness. Somehow she kept
herself curiously enfranchised from lovers. Her friendly frankness
gave them a status it was difficult to overcome.
"I never expected to enjoy myself so much again," said M. de
Ronville, when they were in the carriage. "It is an excellent thing to
go on moving with the world, to keep in touch with the things that
make up the sum of life, instead of feeling they belong to the gone-
by time, and you have no interest in them."
How much like his olden self he was, Aldis Bartram thought. He
wondered if he had been at fault in letting him drop down. There
was much perplexing business, and he had hated to bother the elder
man with it. Sometimes it seemed tedious to explain. Had he grown
selfish in certain ways, preferring to take the burthen, rather than
the trouble of sharing it with another? He had much personal
ambition, he was in full earnest of a man's aims and life purposes.
Yet it was this man who had helped him to the place whereon he
stood, and it was not honorable to crowd him out under the plea
that his best days were over.
It seemed, indeed, as if days fairly flew by, there was so much
crowded in them. When the morning was fine, Daffodil insisted they
should drive out. It was delightful to keep bowing and smiling to
friends, with this attractive girl beside him. He went to some
meetings of the Philosophical Society, and he took a new interest in
the Library plans.
"You certainly have worked a transformation," Bartram said to
Daffodil, when M. de Ronville consented to go to a concert with
them, to hear two remarkable singers, who had come from abroad.
"You will have to stay. Didn't I hear you discussing Pittsburg with
Mrs. Jarvis?"
"Oh, they are longing for me to return. And in two days March will
come in, that will be spring. And I was only to stay through the
winter."
"But March is a cruel and deceitful travesty on spring. February has
been too short."
"But they want me. And, yes, I want to see them all, and the
garden, and the woods, and what new things have happened to
Pittsburg. For there is something new coming in all the time."
Her face was so eager and full of happy interest.
"Well—I don't know what we shall do without you"; and the
inflection of his voice was disconsolate. "I am afraid we shall fall
back to the old routine. I am a busy man, you know, and have to
shoulder a great many cares not really my own. Perhaps, too, I
haven't the divine art of making a house bright, a woman's
province."
"Oh, Mr. Bartram, I will tell you;" in a clear, earnest tone. "Why do
you not marry, and bring some one here to do it? There are so many
charming girls, sometimes I feel quite unimportant and ignorant
beside them."
She uttered it in the same manner she might have asked why he did
not bring home some flowers to grace the study table. Her lovely
eyes were raised to his in the utmost innocence, and not a tint of
color wavered on her cheek. His flushed with sudden surprise.
"Perhaps the charming young girl would consider it a dull house for
life, and then elderly people have whims and fancies—well, younger
men do. I have myself. And it would be asking a good deal."
"I think uncle hasn't many whims, and he does keep them in the
background. You almost have to watch for them. Why, think of
grandad!" and she laughed with a soft musical sound. "What he
liked yesterday he may not like at all to-day, so Norry does the new
thing, and says nothing about the other. And he often disputes with
father as to whether there was any real need for the war, and that
we would be better off under King George. But uncle is so large-
minded, and then he has so many refined and delightful tastes. But
you would get lonesome if you were not very well, and no one came
to cheer you up, or bring you new thoughts and bright bits of things,
that were going on in the world outside."
She paused suddenly, and flushed like a culprit, looking more
beguiling than ever, with her downcast eyes.
"I suppose I oughtn't have said it, but it seems true to me, only I'm
not blaming you. You have a great many things to attend to, and
you must do them in a man's way, devote your whole mind to them,
and you can't be frivolous, or other people's business would suffer. If
I hadn't any one I would come and stay, but—I love them, and
sometimes, in spite of the pleasure, my heart is almost torn in two
with the longing. I said I would come back in the spring, and I must
go. Then it will not be quite so bad, for Madame Clerval will be in
and out, and he is so much better. And you'll let him take an interest
in business, when he feels like it—oh, I seem to be giving you
advice, and I sincerely beg your pardon. After all, I am not much
more than a little girl, and I am talking as if I was old and wise;" and
a sudden shame flamed her cheeks with scarlet.
"I think you have been wise, and sweet, and patient, without
growing old. You have done a great deal for your guardian this
winter—I really was afraid we should not have him with us for very
long, and he did seem to wish for you so. Perhaps we were selfish,
he and I."
"Oh, I was ready to come, too. It has been a delightful winter, and
everybody has been so good to me, I've been just full of pleasure.
But when you love those you have left behind, you sometimes feel
as if you could fly."
She winked very fast, then made a sudden dab at her eyes, and half
laughed, too.
"I think I understand. I have had no one to love dearly since I was a
little lad, and all I remember about my mother is that she was pale,
and ill, and could not endure a noise. Then I was put in school, and
my father went away and died. When I was eighteen I went in M. de
Ronville's office, and finished my studies. He has been my best
friend, really like a father to me. I ought to make all the return in my
power."
"Oh;" and there was a bewildering sweetness in her tone. "I have
been so happy most of my life, and had so many to love me."
Then that unfortunate episode had not cost her any deep-seated
grief. Had she loved at all, or was it only a childish fancy? He hoped
it was, for the sake of her future.
He turned then and went out of the room. M. de Ronville had been
up in his dressing-room, with his valet, and now he went to the
library, and she followed him. There were some reports to look over,
then the carriage came for them. It was sunny, with very little wind,
and they had plenty of wraps.
Aldis Bartram went his way to the office. The two clerks were there
and busy. He opened his letters, and answered several, the others
had need of some legal opinions to be looked up. Then he took up a
rather complicated case, but he soon lost the thread of it, for
Daffodil's almost upbraiding voice haunted him. He had been
outwardly patient many a time when all was irritation within, for he
was too manly and too really grateful to show impatience.
Had Daffodil's being there this winter proved the source of the
reaction in M. de Ronville's health? Had loneliness intensified the
disease and discomfort? Perhaps. And now two or three young men
dropped in, and had entertaining talks with him. Or was it because
they liked the byplay of the pretty, vivacious girl, who never made
herself the first attraction.
"Marry some pretty, charming young girl!" Where would he find one
to M. de Ronville's liking?
CHAPTER XVII
OH, WHICH IS LOVE?
March opened cold and stormy. Rheumatism made a clutch at M. de
Ronville. For several days he did not come downstairs, but insisted
that some of the guests must come to him. Dr. Langdale skipped
away from a lecture he really desired to hear, and spent an hour
comforting the invalid. Madame Clerval came in with a budget of
news and friendly gossip, and Daffodil talked of her little girlhood,
and old Pittsburg, as they had begun to call it, and sitting on the
arm of great-grandfather's chair, and listening to tales of a still older
time. He did not wonder that his friend Duvernay had lived to be
almost a hundred, with all that affection to make the way pleasant.
Then he improved and came downstairs, took up chess-playing, and
little promenades on the porch when the sun shone. And then the
talk veered round to Daffodil's departure. He would not hear
anything about it at first.
"Yet we have no right to keep her away from her own household,
when she has been brave enough to give up all the winter to us," Mr.
Bartram said.
"Oh, no, I suppose not. If I was younger, or in assured health, I
should go and spend the summer with them. Oh, don't look so
startled. I know it wouldn't do, with my uncertain health."
Aldis smiled. "If the summer is fine, and you keep pretty well, we
might both take a trip. I would hardly trust you to go alone."
"So we might." The elder was gratified with the consideration.
"Aldis?" presently, in a half-enquiring tone.
"Well?" glancing up.
"Do you think—that Dr. Langdale—that there is anything between
him and Daffodil?"
"There has been some talk. But young Pemberton is devoted to her
as well."
"With either she would have to come back here to live. I like the
doctor. He is such a fine, large-hearted, sympathetic young fellow,
with so much real charity for suffering. I seem to be envying other
people's sons and daughters;" ending with a longing sound. "Yes, if
she were in love with him."
Aldis Bartram experienced a feeling of protest. Yet, why should he
object? They were both young, they had been friends from
childhood, and he was certainly worthy of her.
That very evening he dropped in. There had been a wonderful
surgical operation on a poor fellow, who had been mashed and
broken by a bad fall. There had been a dispute at first, whether they
could save him intact, but after hours of the most careful work there
was a good chance. Dr. Langdale was so proud and enthusiastic,
giving every one his due with no narrowness.
Then he said, "Oh, Daffodil, are you really going home?"
"They have sent for me. The winter has gone!" and there was a
piquant smile hovering about her face.
"It has been such a short winter I have not done half the things I
planned to do. But I am resolved to run away some time in the
summer. It is ungrateful not to visit mother. And I do want to see the
town, and all the old friends."
"Oh, do come!" There was a joyous light in her eyes, and a
sweetness played about her lips.
Yes, he surely thought he would. Then they went on about other
matters. Bartram was not much versed in love indications, but
something rose within him—as if there should be a higher, stronger,
more overwhelming love for her.
She would make them talk cheerfully about her going. She said
sagely there was such a thing as wearing out one's welcome, and
that now she should feel free to come again.
"Next winter," said her guardian. "I think I can get along through the
summer with this thought to sustain me, but I shall be a year older,
and perhaps more feeble."
"I strictly forbid either of the consequences;" she laughed with
adorable gayety, her eyes alight with fun.
"One would think I was of great consequence," she exclaimed a few
days later, "by the lamentations my friends make. Or is it a fashion?
It will make it harder for me to go. If we could move Pittsburg over!
But there are the splendid rivers, and the hills covered with
rhododendrons. And, you see, I shall miss the daffodils."
"If it is such sorrow to part with one, I hardly know how you can
endure losing so many," said Aldis Bartram gravely.
She looked at him enquiringly. He seldom paid compliments to any
one but Madame Clerval.
There were bloom and beauty enough in the grand old town, where
every point was romantic. Every day Daffodil and her guardian were
out driving, until it seemed to her she could have found her way
about in the dark. And in his office Aldis Bartram sat thinking how
lonely the house would be without the sunshine of her golden head,
and the sound of her sweet, merry voice, her small, thoughtful ways,
and the ease with which she could change from one mode of action
that she saw was not bringing about a desirable result. At first he
considered this a sort of frivolity, but he understood presently that
she not infrequently gave up her own pleasure or method for
something that suited M. de Ronville better.
He was ambitious, and he had marked out a career for himself. He
meant to be rich and respected, his instincts were all honorable, and
this had commended him to his employer, who detested anything
bordering on double dealing. So, from one position he had been
advanced to another, and by persistent study had taken his degree
with honor. He enjoyed the life of the class with which he was in
keen touch, and he found he could maintain a degree of mental
superiority that satisfied his ambition.
There had been a partnership; he was junior counsel, and some of
the clients preferred the young, broad-minded man. Then had come
the proffer of a home that really surprised him. There were no
relatives to be jealous; why, then, should he not be as a son to this
man, who no longer felt equal to the burthen and heat of the new
day that had dawned on the country, and was calling forth the
highest aims and energies of the men of the time?
There had been one intense fascination in his life that had turned to
the ashes of bitterness. And now, while he was affable and enjoyed
the society of women, he considered himself proof against their
blandishments. He had heard of Daffodil's interrupted marriage, and
gave her a very sincere sympathy. But he had not been warmly in
favor of her visit. Still, it seemed cruel and selfish not to agree to the
longing of the invalid, who had an obstinate idea that his days were
numbered. A pet and play-thing was perhaps what he needed, for
sometimes the devotion exacted bored him and seemed a painful
waste of time and energy.
Then M. de Ronville saw the necessity of arranging his guardianship
of Daffodil Carrick on a different basis, so that there might be no
trouble at his death. Her father might not understand all the fine
points, and need some legal aid. This had brought about the visit to
Pittsburg, and he had joined his solicitation to that of the guardian,
truly believing M. de Ronville's days were numbered, and he did
fervently desire to give him whatever happiness and comfort was
possible.
But Daffodil was different from the vague idea he had formed of her.
She was not a sentimental girl, even if she had been caught by a
specious love, and though gay and eager, had a tender, truthful, and
noble side to her nature. They were all of a higher class than he had
thought possible, and Felix he considered quite an unusual boy. Mr.
Carrick had made one brief explanation of the marriage, none of the
others alluded to it.
"But you know that the law holds her as an unmarried woman.
There was nothing binding in the vows on her side, and pure fraud
on his," said Bartram decisively.
"Yes, we are aware of that, but young as she is, it has changed her
in some respects. But she is dearer than ever to us. I deprecate this
fashion of such youthful marriages, though mine has been very
happy," returned the father.
Dr. Langdale came in one morning with a face full of the highest
satisfaction. Bartram had been lingering about, discussing the
journey. Madame Clerval had offered one of her French maids, but
she knew so little of American ways.
"Daffodil," the doctor exclaimed, "will you take me for an escort? I
find there is nothing very important for the next few weeks. I have
but one more lecture in my course. And I do want to see mother. So,
if you have no objection——"
"Why, I should be delighted, though I begin to feel quite like a wise
and travelled body. And think how women are coming from abroad
and from Canada, and going West, and all over, and reach their
destination safely. But I shall be very glad all the same, and your
mother will be wild with joy."
"I am afraid we do not think of the pleasure we can give our elders,
who, in the nature of things, have less time for the enjoyment of
their children. And I feel ashamed that I have allowed the time to
slip by, content with a hurried letter. I mean to do better in the
future."
"And I applaud your decision," exclaimed M. de Ronville. "Oh, I think
you young people really do not know how much happiness you can
give us elders just by the sight of your happy faces, and a little
cordial attention."
Daffodil glanced at Dr. Langdale with a smile that seemed almost a
caress, it was so approving, enchanting. Aldis Bartram caught it and
turned away, saying—
"I must leave you to perfect arrangements. I am late now, so I must
wish you good-morning," bowing himself out of the room.
He was very busy, and did not go home to dinner, as he had been
doing of late. And it was not until he was walking home in the late
afternoon that he allowed himself to think of Daffodil's departure.
"She will marry Dr. Langdale and come back here to live, which will
be a great pleasure to M. de Ronville," he said to himself,
remembering it had his friend's approval. And why should it not have
his? Yet he felt as if he did not cordially assent. And if she returned
next winter—he lost a sudden interest in the plan. They would be
lovers and there would be their joy and satisfaction flaunted in
everybody's face.
How could Daffodil keep so bright and cheerful? Had she any real
depth? Did not every change, every new plan appeal to her just the
same?
But if he had seen her with her arms about Mrs. Jarvis' neck, and
the tears in her eyes, he would not have made the comment to
himself. And the tender, beseeching tone in which she was saying—
"Oh, you will not let him miss me too much. And when it is pleasant,
won't you walk about the garden with him and praise his roses and
the flowers he cares for? And keep him thinking that he is better,
and has years yet to live, and if Mr. Bartram will go on being devoted
to him."
"Mr. Bartram seems to have grown more tenderly thoughtful. Of
course, he has a great deal on his mind, and now there are so many
perplexing questions about the country, and when one is tired out
with the day's work it is hard to rehearse it all over. Oh, my dear, I
think you have worked a change in us all with your sweet, generous
ways, and your lovely outflowing youth. I am afraid I was beginning
to think too much of my own comfort."
Dr. Langdale proved himself most solicitous. Bartram found the
planning was taken quite out of his hands, and he chafed a little.
Madame Clerval declared herself inconsolable, but she had the fine
grace that speeds the parting guest when the going is inevitable.
There was only one day more. M. de Ronville had his breakfast sent
upstairs. Daffodil went to find some papers her guardian was going
over, and turning, she met Aldis Bartram entering the library.
"I was afraid you might forget them," she said, handing the packet
to him.
"Thank you." How often she had charged her mind with these little
things.
"I suppose," he began in a wandering sort of tone, as if his mind
had strayed to something else, "that it will not really be out of order
to congratulate you, since it will be a long while before I shall see
you again."
"Oh, about going home? But I shall often think of you all here, and
wish the old fairy stories were true, where you could be transported
elsewhere in a moment. I think I did truly believe in them once."
How charming she was in that absolute simplicity, the exquisite,
innocent, glowing face too frank for concealment. He had no
business to probe her secret, and yet he must know.
"Oh, I meant, you will not come back to us the same. You will have
learned the lesson of love, and I hope—you will be very happy."
"I don't understand"—a puzzled line settling in her fair brow. "Oh!"
suddenly relieved, and then half smiling, "did you think," and then
her face crimsoned to its utmost capacity, "that I, that Dr. Langdale
—it is a mistake. We were dear friends in childhood, we are warm
friends now. For, you see, he has been like a little bit of Pittsburg to
me, and sometimes, when I was longing for the dear ones at home,
it was comforting to talk them over. And he has no thought of
marrying in a long, long while. He means to do so much first."
Was she a finished coquette by the grace of nature? Young men
were not given to consideration of this or that when the bewildering
passion seized them. But coquette or not, a sharp, overmastering
knowledge seized him. Once she had advised him to marry and
bring in the household a charming girl. She recognized that his duty
would be to M. de Ronville while he lived. He knew that, too, if he
would not prove himself an ingrate. And here was the charming girl.
He looked at her so long and steadily that there came faint colors in
her face, growing deeper, the lines about her mouth showed
tremors, the bronze-fringed lids drooped over her eyes, and she
turned away. But the delicious half-bashful movement set his pulses
aflame.
"Daffodil," and he caught her hand, "if there is no other among
these young men, or even at home, may I not sue for a little favor? I
know it surprises you; then perhaps I am too old to win a young
girl's regard, love I mean——"
"Oh, you must not," she interrupted. "For I think you hardly like me
—you did not at first. And then, I—well—I do not mean to marry.
You know there was the——"
"Which simply has no weight in your life."
"But you see, I thought I loved him. Oh, I did love him. And I was so
happy. Why, I would have gone to the end of the world with him!
Only when one deceives you, when one dares not tell the whole
truth, and when one cannot, does not want to give up wealth and
station, what was love is some way crushed out. But how could I tell
if any new love was the right thing? I might be mistaken again. And
there are fickle women in the world I have heard, who can love
many times. I don't desire to be one of them. Maybe it is only
friendship I am fitted for."
She was trembling in every pulse, though she had made such a
brave defence. And she seemed to him a hundred times sweeter
than she ever had before. He had much ado not to clasp her to his
heart. "My dear little Daffodil," he said with passionate tenderness,
"though you have been wooed and said marriage vows, you know
nothing about a true and fervent love. That was not much beyond a
child's fancy, and you have overlived it, or you could not be so light-
hearted. It is only a dream in your life. And I will wait until the
woman's soul in you wakes. But I shall not let you go from my
influence, I shall keep watch and ward, and try to win you."
"No, no, I am not worth all that trouble. No, do not try," she
pleaded.
"I shall take your earlier advice. You said I must marry some
charming girl and bring her here. No other girl or woman could
satisfy M. de Ronville as well."
"Did I advise you to do that?" and she blushed daintily. "Well," and
there was a glint of mischief in her eyes, soft as they were, "once I
was offered to you, and you declined."
"Offered to me?" in surprise.
"When I was here before. It was in this very library. I was outside,
and when I knew who was meant I ran away."
"Oh, you were such a child then! And I was doing something that I
have always despised myself for. I knew a beautiful and fascinating
woman, who led me to believe she cared a great deal for me. And
then she laughed at my folly. I deserved it for my blindness. So you
see, I too had a rude awakening, and found that it was not love, but
a mere sham. I believe for a month or so I have been trying not to
love you, shutting my eyes to a longing that stirred all my nature.
And now that I have admitted it, it has taken a giant's growth in a
few hours. I will wait until you can give me the true, sincere regard
of your soul. But I could not let you go until I had settled whether I
had any ground for hope. Shall we be friends, dear and fond friends,
until that time? But I want to be loved sincerely, deeply."
She stood like a lovely culprit before him, and then he did enfold her
in his arms, and pressed his lips against her blushing cheek.
"Oh, I cannot tell—yes, I like you—and you will be good to him while
I am gone. But it is new and strange to me, and I cannot promise."
"But there is no one else—tell me that."
"There is no one else. But whether—I can love again;" and there
was a great tremble in her voice, "whether it would be right."
"Oh, little innocent, you will find the right and the truth some day, I
feel assured of that. I can trust you to tell me by word or sign when
that day comes, for I know you will be honest. And now I must go,
but I take with me a joy that will make glad the days and weeks of
separation. Oh, my little darling!"
He went out of the house with a proud tread. He would never pause
until he had won her. His soul was startled and roused by the
sudden revelation of himself. He had supposed he should marry
sometime, after his duty was done here, for he could not imagine a
woman broad enough to share it with him. And here an angel had
touched him with her fine beneficence, and shown him the duty in a
stronger, truer light.
There was not much time for the ardent side of love, though Aldis
Bartram had to fight with himself for a show of mere friendliness.
She was to go at ten the next morning, and friends came to escort
her.
"And I shall stay and help our good friend to bear the trial of
parting," declared Madame Clerval. "We will talk over your virtues
and your shortcomings, the lovers you might have had if you had
been an astute young woman, and try to shed some sunshine on the
doleful days until next winter."
There was the maid with some budgets, there was Dr. Langdale,
proud and serene enough for a lover, and it did rouse a spasm of
jealousy in the soul of Aldis Bartram. But he knew she was truth
itself, and he could depend upon her.
CHAPTER XVIII
A REVELATION
It was a lovely journey if the term could be applied to the old-
fashioned stagecoach. But the season of the year, the bloom and
beauty everywhere, and the pleasant companionship lightened the
few discomforts for Daffodil. There are natures that refrain from
spoiling anticipations by cares or perplexities left behind, and hers
was one. Indeed, hers was not complex, and people, women
especially, had not learned to crowd so many interests, and fears,
and hopes together. She would see those she loved the best, yes,
she did love them the best of all now.
How glad they were to get her back! Yes, there were changes and
changes. New business plans and firms, old ones enlarged,
discoveries of coal and iron all about, materials for glass-making, a
paper mill under consideration.
But the war was not yet over. The advisers of the King had begun to
adopt a tone of insolence toward the young Republic; indeed, in
spite of peace being signed, there was still an endeavor to stir up
the Indians on the outskirts of many of the towns. The Indian
villages along the Maumee received supplies of arms and
ammunition, and were fortifying their own forts. The alarm spread
down the Ohio. The British had not yet given up all the forts they
had held in the preceding war, in spite of the agreements.
Tired of inaction, Lieutenant Langdale had, with several others,
offered his services to General Anthony Wayne, as there was great
need of trained officers. So Mrs. Langdale was doubly delighted with
this visit of her son, of whom she was quite as proud as of her
soldier.
"And I hope you have made good your chance with Daffodil Carrick,"
she said to him a few days after his return. "She'll be quite worth the
winning, even if the father's money should all go to the son, who is
a very promising lad, I hear. But they count on having a big place
over the river, and that is all her share. One of you boys ought to
win her. I thought it would be Ned. And you have had a chance all
winter."
Archibald smiled, but there was no disappointment in it.
"She was a great favorite all through the winter, and she can marry
any time she likes. But I have too much to do to take upon myself
family cares, and I think she isn't the sort of girl to be in a hurry. We
are just fine, sincere friends."
"But I want you to marry. And I've counted on grandchildren. I wish
I had you both settled just around me. I shall be a lonesome old
woman."
"Then when I am rich enough to set up a house, you shall come and
live with me."
"Do you think Dilly's going to let that miserable mess of a marriage
spoil all her life?"
"Oh, she is very happy, mother; girls don't marry as young as they
did, and it is a good thing, too. They have some years of bright, gay
girlhood, and won't get worn out so soon. Daffodil is a charming
girl."
"But she's getting quite along, and it isn't like being a widow either,"
said the mother, who thought every girl ought to marry.
Daffodil watched mother and grandmere with longing eyes. Yes,
grandmere was getting old. Her mother was losing the pretty
girlishness, but she was very happy in her husband, and her son,
who was tall and very good-looking, quite toned down in manner.
The house had no more changes. Here was her pretty room. Oh,
yes, there was a new bright rag carpet on the floor. She went around
with a tender touch on everything, patting the white pillow-slips,
straightening a picture or two, and wondering in a curious fashion if
sometime her brother's wife would be here and a group of merry
children—she hoped there would be a houseful of them. And gran
would be a great-grandfather, and sit in the big chair at the corner of
the fireplace, that he had covered over with buckskin of his own
tanning. Where she would be she did not plan. Only she would not
mind being an old maid, she thought.
Everybody in the little circle supposed she would marry Dr. Langdale,
and were surprised when his mother sorrowfully admitted it was not
to be.
"There's them that goes through the woods, and picks up a crooked
stick at the last;" and Norah shook her head resentfully.
"My stick won't be crooked, I promise you," laughed the girl.
"You may have no stick at all and go limping afoot and alone," was
the curt rejoinder.
She was very happy, why she could hardly tell, for she felt she ought
not to be. There came a letter with the stamp of the office on it and
it had two enclosures. Her guardian's was most pleasant and
fatherly. They missed her very much, but Mrs. Jarvis had taken on a
new phase of kindliness so that he should not long too much for
Daffodil, and Aldis was like a son. They went out driving together.
And Aldis had grown so fond of the garden that he had not used to
care much about. The weather was fine and he really was quite well
for an old gentleman.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com

More Related Content

PDF
Starting Out With Java From Control Structures Through Objects 7e Tony Gaddis
PDF
Starting Out With Java From Control Structures Through Objects 7th Edition To...
PDF
(eBook PDF) Java How to Program, Late Objects Global Edition 11th Edition
PDF
A Functional Approach to Java: Augmenting Object-Oriented Java Code with Func...
PDF
Java How To Program Early Objects Eleventh Edition Deitel Harvey M Deitel
PDF
Introducing Play Framework Java Web Application Development Second Edition Pr...
PDF
Test bank for Big Java: Early Objects 6th Edition by Horstmann
PDF
Core Java Vol 1 2 For The Impatient And Effective Pack 12th Ed Cay S Horstmann
Starting Out With Java From Control Structures Through Objects 7e Tony Gaddis
Starting Out With Java From Control Structures Through Objects 7th Edition To...
(eBook PDF) Java How to Program, Late Objects Global Edition 11th Edition
A Functional Approach to Java: Augmenting Object-Oriented Java Code with Func...
Java How To Program Early Objects Eleventh Edition Deitel Harvey M Deitel
Introducing Play Framework Java Web Application Development Second Edition Pr...
Test bank for Big Java: Early Objects 6th Edition by Horstmann
Core Java Vol 1 2 For The Impatient And Effective Pack 12th Ed Cay S Horstmann

Similar to Java Illuminated An Active Learning Approach 5th Julie Anderson (20)

PDF
Objectoriented Programming And Java 2nd Ed Danny C C Poo Derek Beng Kee Kiong...
PDF
Software Engineering A Methodical Approach 1st Ed Elvis Foster
PDF
Manish123_CV
PDF
Surviving the technical interview
PDF
Microsoft Visual Basic Programs To Accompany Programming Logic And Design 3rd...
PDF
JavaFX Developing Rich Internet Applications 1st Edition Jim Clarke
PDF
00 C++ For Engineers and Scientists.pdf
PDF
Programming Elixir Functional Concurrent Pragmatic Fun 1st Edition Dave Thomas
PDF
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
PDF
Selenium web driver | java
PDF
Gundecha U. - Selenium Testing Tools Cookbook - 2012.pdf
PDF
Cv vipul valvi_java_developer
PDF
Nim in Action 1st Edition Dominik Picheta
PDF
Practical jQuery 1st Edition Mukund Chaudhary
PDF
Agile Software Development Susheela Hooda Vandana Mohindru Sood
DOCX
java traning report_Summer.docx
PDF
Agile Software Development : Trends, Challenges and Applications 1st Edition ...
PDF
Learn Google Flutter Fast: 65 Example Apps Mark Clow
PDF
Android Programming For Developers John Horton Helder Vasconcelos
PDF
Cv vipul valvi_java_developer
Objectoriented Programming And Java 2nd Ed Danny C C Poo Derek Beng Kee Kiong...
Software Engineering A Methodical Approach 1st Ed Elvis Foster
Manish123_CV
Surviving the technical interview
Microsoft Visual Basic Programs To Accompany Programming Logic And Design 3rd...
JavaFX Developing Rich Internet Applications 1st Edition Jim Clarke
00 C++ For Engineers and Scientists.pdf
Programming Elixir Functional Concurrent Pragmatic Fun 1st Edition Dave Thomas
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
Selenium web driver | java
Gundecha U. - Selenium Testing Tools Cookbook - 2012.pdf
Cv vipul valvi_java_developer
Nim in Action 1st Edition Dominik Picheta
Practical jQuery 1st Edition Mukund Chaudhary
Agile Software Development Susheela Hooda Vandana Mohindru Sood
java traning report_Summer.docx
Agile Software Development : Trends, Challenges and Applications 1st Edition ...
Learn Google Flutter Fast: 65 Example Apps Mark Clow
Android Programming For Developers John Horton Helder Vasconcelos
Cv vipul valvi_java_developer
Ad

Recently uploaded (20)

PPTX
Cell Structure & Organelles in detailed.
PPTX
Lesson notes of climatology university.
PPTX
Pharma ospi slides which help in ospi learning
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Complications of Minimal Access Surgery at WLH
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Classroom Observation Tools for Teachers
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Sports Quiz easy sports quiz sports quiz
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Cell Structure & Organelles in detailed.
Lesson notes of climatology university.
Pharma ospi slides which help in ospi learning
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Pre independence Education in Inndia.pdf
human mycosis Human fungal infections are called human mycosis..pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Supply Chain Operations Speaking Notes -ICLT Program
Complications of Minimal Access Surgery at WLH
GDM (1) (1).pptx small presentation for students
Final Presentation General Medicine 03-08-2024.pptx
01-Introduction-to-Information-Management.pdf
Insiders guide to clinical Medicine.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Classroom Observation Tools for Teachers
O5-L3 Freight Transport Ops (International) V1.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Sports Quiz easy sports quiz sports quiz
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Ad

Java Illuminated An Active Learning Approach 5th Julie Anderson

  • 1. Java Illuminated An Active Learning Approach 5th Julie Anderson download https://ebookbell.com/product/java-illuminated-an-active- learning-approach-5th-julie-anderson-34812764 Explore and download more ebooks at ebookbell.com
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Java Illuminated An Active Learning Approach 5th Julie Anderson https://ebookbell.com/product/java-illuminated-an-active-learning- approach-5th-julie-anderson-34809294 Java Illuminated An Active Learning Approach 4th Edition Julie Anderson https://ebookbell.com/product/java-illuminated-an-active-learning- approach-4th-edition-julie-anderson-6738268 Java Illuminated An Active Learning Approach 6th Edition 6th Julie A Anderson https://ebookbell.com/product/java-illuminated-an-active-learning- approach-6th-edition-6th-julie-a-anderson-50732572 Java Illuminated An Active Learning Approach 4th Edition Julie Anderson https://ebookbell.com/product/java-illuminated-an-active-learning- approach-4th-edition-julie-anderson-5688376
  • 3. Buddhism Illuminated Manuscript Art From Southeast Asia San San May https://ebookbell.com/product/buddhism-illuminated-manuscript-art- from-southeast-asia-san-san-may-7402618 Java The Ultimate Guide To Learn Java And Python Programming Peter Hoffman Stephen Hoffman https://ebookbell.com/product/java-the-ultimate-guide-to-learn-java- and-python-programming-peter-hoffman-stephen-hoffman-50199732 Java The Ultimate Guide To Learn Java Programming And Computer Hacking Java For Beginners Java For Dummies Java Apps Hacking Html Javascript Programming Developers Coding Css Php Book 2 Peter Hoffman Hoffman https://ebookbell.com/product/java-the-ultimate-guide-to-learn-java- programming-and-computer-hacking-java-for-beginners-java-for-dummies- java-apps-hacking-html-javascript-programming-developers-coding-css- php-book-2-peter-hoffman-hoffman-7431836 Java An Introduction To Problem Solving And Programming 7th Edition Walter Savith https://ebookbell.com/product/java-an-introduction-to-problem-solving- and-programming-7th-edition-walter-savith-46196888 Java For Developers Pocket Primer Oswald Campesato https://ebookbell.com/product/java-for-developers-pocket-primer- oswald-campesato-47386772
  • 6. JAVA Illuminated An Active Learning Approach FIFTH EDITION Julie Anderson Rollins College Hervé Franceschi Loyola University Maryland JONES BARTLETT LEARNING ™
  • 7. World Headquarters Jones & Bartlett Learning 5 Wall Street Burlington, MA 01803 978-443-5000 info@jblearning.com www.jblearning.com Jones & Bartlett Learning books and products are available through most bookstores and online booksellers. To contact Jones & Bartlett Learning directly, call 800-832-0034, fax 978-443-8000, or visit our website, www.jblearning.com. Substantial discounts on bulk quantities of Jones & Bartlett Learning publications are available to corporations, professional associations, and other qualified organizations. For details and specific discount information, contact the special sales department at Jones & Bartlett Learning via
  • 8. the above contact information or send an email to specialsales@jblearning.com.
  • 9. Copyright © 2019 by Jones & Bartlett Learning, LLC, an Ascend Learning Company All rights reserved. No part of the material protected by this copyright may be reproduced or utilized in any form, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the copyright owner. The content, statements, views, and opinions herein are the sole expression of the respective authors and not that of Jones & Bartlett Learning, LLC. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not constitute or imply its endorsement or recommendation by Jones & Bartlett Learning, LLC and such reference shall not be used for advertising or product endorsement purposes. All trademarks displayed are the trademarks of the parties noted herein. Java Illuminated, Fifth Edition, is an independent publication and has not been authorized, sponsored, or otherwise approved by the owners of the trademarks or service marks referenced in this product. There may be images in this book that feature models; these models do not necessarily endorse, represent, or participate in the activities represented
  • 10. in the images. Any screenshots in this product are for educational and instructive purposes only. Any individuals and scenarios featured in the case studies throughout this product may be real or fictitious, but are used for instructional purposes only. 23993-5 Production Credits Director of Product Management: Matthew Kane Product Manager: Laura Pagluica Product Assistant: Rebecca Feeney Production Manager: Carolyn Pershouse Production Manager: Dan Stone VP, Manufacturing and Inventory Control: Therese Connell Media Development Editor: Shannon Sheehan Rights & Media Specialist: Thais Miller Cover & Title Page Design: Kristin E. Parker Cover Image (Title Page, Part Opener, Chapter Opener): © itsskin/Getty Images Printing and Binding: LSC Communications Cover Printing: LSC Communications
  • 11. Library of Congress Cataloging-in-Publication Data ISBN13: 978-1-284-23993-5 Application submitted. 6048 Printed in the United States of America 22 21 20 19 18 10 9 8 7 6 5 4 3 2 1
  • 12. Dedications To the memory of my parents, Glenn and Rosemary Austin, my first teachers. – Julie Anderson A ma mère, trop tôt disparue, et à mon père. – Hervé Franceschi
  • 13. Contents Preface Turing’s Craft CodeLab Student Registration Instructions Acknowledgments Chapter 1 Introduction to Programming and the Java Language 1.1 Basic Computer Concepts 1.1.1 Hardware 1.1.2 Operating Systems 1.1.3 Application Software 1.1.4 Computer Networks and the Internet 1.2 Practice Activity: Displaying System Configuration 1.2.1 Displaying Windows Configuration Information
  • 14. 1.2.2 Displaying Mac OS Configuration Information 1.3 Data Representation 1.3.1 Binary Numbers 1.3.2 Using Hexadecimal Numbers to Represent Binary Numbers 1.3.3 Representing Characters with the Unicode Character Set 1.4 Programming Languages 1.4.1 High- and Low-Level Languages 1.4.2 An Introduction to Object-Oriented Programming 1.4.3 The Java Language 1.5 An Introduction to Programming 1.5.1 Programming Basics 1.5.2 Program Design with Pseudocode 1.5.3 Developing a Java Application 1.5.4 Programming Activity 1: Writing a First Java Application Debugging Techniques Testing Techniques 1.5.5 Making a JAR File 1.6 Chapter Summary 1.7 Exercises, Problems, and Projects 1.7.1 Multiple Choice Exercises 1.7.2 Converting Numbers 1.7.3 General Questions 1.7.4 Technical Writing
  • 15. 1.7.5 Group Project (for a group of 1, 2, or 3 students) Chapter 2 Programming Building Blocks—Java Basics 2.1 Java Application Structure 2.2 Data Types, Variables, and Constants 2.2.1 Declaring Variables 2.2.2 Integer Data Types 2.2.3 Floating-Point Data Types 2.2.4 Character Data Type 2.2.5 Boolean Data Type 2.2.6 The Assignment Operator, Initial Values, and Literals 2.2.7 String Literals and Escape Sequences 2.2.8 Constants 2.3 Expressions and Arithmetic Operators 2.3.1 The Assignment Operator and Expressions 2.3.2 Arithmetic Operators 2.3.3 Operator Precedence 2.3.4 Programming Activity 1: Converting Inches to Centimeters 2.3.5 Integer Division and Modulus 2.3.6 Division by Zero 2.3.7 Mixed-Type Arithmetic and Type Casting 2.3.8 Shortcut Operators
  • 16. 2.4 Programming Activity 2: Temperature Conversion 2.5 Chapter Summary 2.6 Exercises, Problems, and Projects 2.6.1 Multiple Choice Exercises 2.6.2 Reading and Understanding Code 2.6.3 Fill In the Code 2.6.4 Identifying Errors in Code 2.6.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 2.6.6 Write a Short Program 2.6.7 Programming Projects 2.6.8 Technical Writing Chapter 3 Object-Oriented Programming, Part 1: Using Classes 3.1 Class Basics and Benefits 3.2 Creating Objects Using Constructors 3.3 Calling Methods 3.4 Using Object References 3.5 Programming Activity 1: Calling Methods 3.6 The Java Class Library 3.7 The String Class The length Method The toUpperCase and toLowerCase Methods The charAt Method The indexOf Methods The substring Methods
  • 17. String Processing 3.8 Formatting Output with the DecimalFormat Class 3.9 Generating Random Numbers with the Random Class 3.10 Input from the Console Using the Scanner Class 3.11 Calling Static Methods and Using Static Class Variables 3.12 Using System.in and System.out 3.13 The Math Class The pow Method The round Method The min and max Methods 3.14 Formatting Output with the NumberFormat Class 3.15 The Integer, Double, Character, and Other Wrapper Classes 3.16 Programming Activity 2: Using Predefined Classes 3.17 Chapter Summary 3.18 Exercises, Problems, and Projects 3.18.1 Multiple Choice Exercises 3.18.2 Reading and Understanding Code 3.18.3 Fill In the Code 3.18.4 Identifying Errors in Code 3.18.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 3.18.6 Write a Short Program
  • 18. 3.18.7 Programming Projects 3.18.8 Technical Writing 3.18.9 Group Project (for a group of 1, 2, or 3 students) Chapter 4 Introduction to Graphical Applications 4.1 JavaFX Application Structure 4.2 The Graphics Coordinate System and Color 4.3 Drawing Shapes and Text 4.4 Drawing Custom Shapes 4.5 Programming Activity 1: Writing an Application with Graphics 4.6 Chapter Summary 4.7 Exercises, Problems, and Projects 4.7.1 Multiple Choice Exercises 4.7.2 Reading and Understanding Code 4.7.3 Fill In the Code 4.7.4 Identifying Errors in Code 4.7.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 4.7.6 Write a Short Program 4.7.7 Programming Projects 4.7.8 Technical Writing 4.7.9 Group Project (for a group of 1, 2, or 3 students) Chapter 5 Flow of Control, Part 1: Selection 5.1 Forming Conditions 5.1.1 Equality Operators
  • 19. 5.1.2 Relational Operators 5.1.3 Logical Operators DeMorgan’s Laws 5.2 Simple Selection with if 5.3 Selection Using if/else Block Scope 5.4 Selection Using if/else if 5.5 Sequential and Nested if/else Statements 5.5.1 Sequential if/else Statements Finding the Minimum or Maximum Values 5.5.2 Nested if/else Statements Dangling else 5.6 Testing Techniques for if/else Statements 5.7 Programming Activity 1: Working with if/else 5.8 Comparing Floating-Point Numbers 5.9 Comparing Objects 5.9.1 The equals Method 5.9.2 String Comparison Methods 5.10 The Conditional Operator (?:) 5.11 The switch Statement 5.12 Programming Activity 2: Using the switch Statement 5.13 Chapter Summary 5.14 Exercises, Problems, and Projects 5.14.1 Multiple Choice Exercises 5.14.2 Reading and Understanding Code 5.14.3 Fill In the Code 5.14.4 Identifying Errors in Code
  • 20. 5.14.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 5.14.6 Write a Short Program 5.14.7 Programming Projects 5.14.8 Technical Writing 5.14.9 Group Project (for a group of 1, 2, or 3 students) Chapter 6 Flow of Control, Part 2: Looping 6.1 Event-Controlled Loops Using while 6.2 General Form for while Loops 6.3 Event-Controlled Looping 6.3.1 Reading Data from the User 6.3.2 Reading Data from a Text File 6.4 Looping Techniques 6.4.1 Accumulation 6.4.2 Counting Items 6.4.3 Calculating an Average 6.4.4 Finding Maximum or Minimum Values 6.5 Type-Safe Input Using Scanner 6.6 Constructing Loop Conditions 6.7 Testing Techniques for while Loops 6.8 Event-Controlled Loops Using do/while 6.9 Programming Activity 1: Using while Loops Task Instructions Troubleshooting 6.10 Count-Controlled Loops Using for 6.10.1 Basic Structure of for Loops 6.10.2 Constructing for Loops
  • 21. 6.10.3 Testing Techniques for for Loops 6.11 Nested Loops 6.12 Programming Activity 2: Using for Loops Instructions Troubleshooting 6.13 Chapter Summary 6.14 Exercises, Problems, and Projects 6.14.1 Multiple Choice Exercises 6.14.2 Reading and Understanding Code 6.14.3 Fill In the Code 6.14.4 Identifying Errors in Code 6.14.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 6.14.6 Write a Short Program 6.14.7 Programming Projects 6.14.8 Technical Writing 6.14.9 Group Project (for a group of 1, 2, or 3 students) Chapter 7 Object-Oriented Programming, Part 2: User-Defined Classes 7.1 Defining a Class 7.2 Defining Instance Variables 7.3 Writing Class Methods 7.4 Writing Constructors 7.5 Writing Accessor Methods 7.6 Writing Mutator Methods 7.7 Writing Data Manipulation Methods
  • 22. 7.8 Programming Activity 1: Writing a Class Definition, Part 1 7.9 The Object Reference this 7.10 The toString and equals Methods 7.11 Static Class Members 7.12 Graphical Objects 7.13 Enumeration Types 7.14 Programming Activity 2: Writing a Class Definition, Part 2 7.15 Creating Packages 7.16 Generating Web-Style Documentation with Javadoc 7.17 Chapter Summary 7.18 Exercises, Problems, and Projects 7.18.1 Multiple Choice Exercises 7.18.2 Reading and Understanding Code 7.18.3 Fill In the Code 7.18.4 Identifying Errors in Code 7.18.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 7.18.6 Write a Short Program 7.18.7 Programming Projects 7.18.8 Technical Writing 7.18.9 Group Project (for a group of 1, 2, or 3 students) Chapter 8 Single-Dimensional Arrays 8.1 Declaring and Instantiating Arrays 8.1.1 Declaring Arrays
  • 23. 8.1.2 Instantiating Arrays 8.1.3 Combining the Declaration and Instantiation of Arrays 8.1.4 Assigning Initial Values to Arrays 8.2 Accessing Array Elements 8.3 Aggregate Array Operations 8.3.1 Printing Array Elements 8.3.2 Reading Data into an Array 8.3.3 Summing the Elements of an Array 8.3.4 Finding Maximum or Minimum Values 8.3.5 Copying Arrays 8.3.6 Changing the Size of an Array 8.3.7 Comparing Arrays for Equality 8.3.8 Displaying Array Data as a Bar Chart 8.4 Programming Activity 1: Working with Arrays Instructions Troubleshooting 8.5 Using Arrays in Classes 8.5.1 Using Arrays in User-Defined Classes 8.5.2 Retrieving Command Line Arguments 8.6 Searching and Sorting Arrays 8.6.1 Sequential Search of an Unsorted Array 8.6.2 Selection Sort 8.6.3 Insertion Sort 8.6.4 Sorting Arrays of Objects 8.6.5 Sequential Search of a Sorted Array 8.6.6 Binary Search of a Sorted Array
  • 24. 8.7 Programming Activity 2: Searching and Sorting Arrays Instructions Troubleshooting 8.8 Using Arrays as Counters 8.9 Methods Accepting a Variable Number of Arguments 8.10 Chapter Summary 8.11 Exercises, Problems, and Projects 8.11.1 Multiple Choice Exercises 8.11.2 Reading and Understanding Code 8.11.3 Fill In the Code 8.11.4 Identifying Errors in Code 8.11.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 8.11.6 Write a Short Program 8.11.7 Programming Projects 8.11.8 Technical Writing 8.11.9 Group Project (for a group of 1, 2, or 3 students) Chapter 9 Multidimensional Arrays and the ArrayList Class 9.1 Declaring and Instantiating Multidimensional Arrays 9.1.1 Declaring Multidimensional Arrays 9.1.2 Instantiating Multidimensional Arrays 9.1.3 Combining the Declaration and Instantiation of Multidimensional
  • 25. Arrays 9.1.4 Assigning Initial Values to Multidimensional Arrays 9.2 Accessing Multidimensional Array Elements 9.3 Aggregate Two-Dimensional Array Operations 9.3.1 Processing All the Elements of a Two- Dimensional Array 9.3.2 Processing a Given Row of a Two- Dimensional Array 9.3.3 Processing a Given Column of a Two- Dimensional Array 9.3.4 Processing a Two-Dimensional Array One Row at a Time 9.3.5 Processing a Two-Dimensional Array One Column at a Time 9.3.6 Displaying Two-Dimensional Array Data as a Bar Chart 9.4 Two-Dimensional Arrays Passed to and Returned from Methods 9.5 Programming Activity 1: Working with Two- Dimensional Arrays Instructions Troubleshooting 9.6 Other Multidimensional Arrays 9.7 The ArrayList Class 9.7.1 Declaring and Instantiating ArrayList Objects 9.7.2 Methods of the ArrayList Class
  • 26. 9.7.3 Looping Through an ArrayList Using an Enhanced for Loop 9.7.4 Using the ArrayList Class in a Program 9.8 Programming Activity 2: Working with the ArrayList Class Instructions Troubleshooting 9.9 Chapter Summary 9.10 Exercises, Problems, and Projects 9.10.1 Multiple Choice Exercises 9.10.2 Reading and Understanding Code 9.10.3 Fill In the Code 9.10.4 Identifying Errors in Code 9.10.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 9.10.6 Write a Short Program 9.10.7 Programming Projects 9.10.8 Technical Writing 9.10.9 Group Project (for a group of 1, 2, or 3 students) Chapter 10 Object-Oriented Programming, Part 3: Inheritance, Polymorphism, and Interfaces 10.1 Inheritance 10.2 Inheritance Design 10.2.1 Inherited Members of a Class 10.2.2 Subclass Constructors
  • 27. 10.2.3 Adding Specialization to the Subclass 10.2.4 Overriding Inherited Methods 10.3 The protected Access Modifier 10.4 Programming Activity 1: Using Inheritance Instructions 10.5 Abstract Classes and Methods 10.6 Polymorphism 10.7 Programming Activity 2: Using Polymorphism Instructions 10.8 Interfaces 10.9 Chapter Summary 10.10 Exercises, Problems, and Projects 10.10.1 Multiple Choice Exercises 10.10.2 Reading and Understanding Code 10.10.3 Fill In the Code 10.10.4 Identifying Errors in Code 10.10.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 10.10.6 Write a Short Program 10.10.7 Programming Projects 10.10.8 Technical Writing 10.10.9 Group Project (for a group of 1, 2, or 3 students) Chapter 11 Exceptions and Input/Output Operations 11.1 Simple Exception Handling
  • 28. 11.2 Catching Multiple Exceptions 11.3 Reading Text Files Using Scanner 11.4 The java.io Package 11.5 Recovering from an Exception 11.6 Writing and Appending to Text Files 11.6.1 Writing to Text Files 11.6.2 Appending to Text Files 11.7 Reading Structured Text Files 11.7.1 Parsing a String Using Scanner 11.7.2 Reading Structured Data Using Scanner 11.8 Programming Activity 1: Reading from a Structured Text File Instructions If you have time … Troubleshooting 11.9 Streams 11.10 Reading Formatted Open Data from a Remote Location 11.10.1 Accessing Remote Data 11.10.2 JSON Formatting and Parsing 11.10.3 Reading, Parsing, Streaming, and Processing Remote Data 11.11 Reading and Writing Objects to a File 11.11.1 Writing Objects to Files 11.11.2 Reading Objects from Files 11.12 Programming Activity 2: Reading Objects from a File
  • 29. Task Instructions: Reading from the transactions.obj File If you have time … Troubleshooting 11.13 User-Defined Exceptions 11.14 Chapter Summary 11.15 Exercises, Problems, and Projects 11.15.1 Multiple Choice Exercises 11.15.2 Reading and Understanding Code 11.15.3 Fill In the Code 11.15.4 Identifying Errors in Code 11.15.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 11.15.6 Write a Short Program 11.15.7 Programming Projects 11.15.8 Technical Writing 11.15.9 Group Project (for groups of 2, 3, or more students) Chapter 12 Graphical User Interfaces Using JavaFX 12.1 The Structure of a JavaFX Application 12.2 GUI Controls 12.3 A Simple Control: Label 12.4 Event Handling: Managing User Interactions 12.5 Text Fields and Command Buttons 12.6 Radio Buttons and Checkboxes
  • 30. 12.7 Programming Activity 1: Working with Buttons Instructions Troubleshooting 12.8 Combo Boxes 12.9 Sliders 12.10 Building a GUI Programmatically 12.11 Layout Containers: Dynamically Setting Up the GUI Using GridPane 12.12 BorderPane Layout, Animations, Sounds, and Lambda Expressions 12.13 Nesting Components 12.14 Mouse and Touch Events 12.15 Using a List to Display a Pie Chart 12.16 Using a List to Display a Dynamic Bar Chart 12.17 Using a Style Sheet to Style the View 12.18 Programming Activity 2: Working with Layout Containers Instructions 12.19 Chapter Summary 12.20 Exercises, Problems, and Projects 12.20.1 Multiple Choice Exercises 12.20.2 Reading and Understanding Code 12.20.3 Fill In the Code 12.20.4 Identifying Errors in Code 12.20.5 Debugging Area—Using Messages from the Java Compiler and Java JVM
  • 31. 12.20.6 Write a Short Program 12.20.7 Programming Projects 12.20.8 Technical Writing 12.20.9 Group Project (for a group of 1, 2, or 3 students) Chapter 13 Recursion 13.1 Simple Recursion: Identifying the General and Base Cases 13.2 Recursion with a Return Value 13.2.1 Computing the Factorial of a Number 13.2.2 Computing the Greatest Common Divisor 13.3 Recursion with Two Base Cases 13.4 Programming Activity 1: Checking for a Palindrome Instructions Task Instructions Troubleshooting 13.5 Binary Search: A Recursive Solution 13.6 Programming Activity 2: The Towers of Hanoi Instructions Task Instructions Troubleshooting 13.7 Recursion Versus Iteration 13.8 Chapter Summary 13.9 Exercises, Problems, and Projects 13.9.1 Multiple Choice Exercises
  • 32. 13.9.2 Reading and Understanding Code 13.9.3 Fill In the Code 13.9.4 Identifying Errors in Code 13.9.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 13.9.6 Write a Short Program 13.9.7 Programming Projects 13.9.8 Technical Writing 13.9.9 Group Projects (for a group of 1, 2, or 3 students) Chapter 14 An Introduction to Data Structures 14.1 Linked Lists 14.1.1 Linked-List Concepts and Structure 14.1.2 Linked-List Basics 14.1.3 Methods of a Linked List 14.1.4 Testing a Linked-List Class 14.2 Linked Lists of Objects 14.2.1 A Linked-List Shell 14.2.2 Generating an Exception 14.2.3 Other Methods of a Linked List 14.2.4 Testing a Linked-List Class 14.3 Implementing a Stack Using a Linked List 14.4 Implementing a Queue Using a Linked List 14.5 Array Representation of Stacks 14.6 Programming Activity 1: Writing Methods for a Stack Class Instructions Troubleshooting
  • 33. 14.7 Array Representation of Queues 14.8 Sorted Linked Lists 14.9 Programming Activity 2: Writing Insert and Delete Methods for a Sorted Linked List Instructions Troubleshooting 14.10 Doubly Linked Lists 14.11 Linked Lists Using Generic Types 14.12 Recursively Defined Linked Lists 14.13 Chapter Summary 14.14 Exercises, Problems, and Projects 14.14.1 Multiple Choice Exercises 14.14.2 Reading and Understanding Code 14.14.3 Fill In the Code 14.14.4 Identifying Errors in Code 14.14.5 Debugging Area—Using Messages from the Java Compiler and Java JVM 14.14.6 Write a Short Program 14.14.7 Programming Projects 14.14.8 Technical Writing 14.14.9 Group Project (for a group of 1, 2, or 3 students) Chapter 15 Running Time Analysis 15.1 Orders of Magnitude and Big-Oh Notation 15.2 Running Time Analysis of Algorithms: Counting Statements 15.3 Running Time Analysis of Algorithms and Impact of Coding: Evaluating Recursive
  • 34. Methods Handwaving Method Iterative Method Proof by Induction Method Other Methods 15.4 Programming Activity: Tracking How Many Statements Are Executed by a Method Instructions Troubleshooting 15.5 Running Time Analysis of Searching and Sorting Algorithms 15.6 Chapter Summary 15.7 Exercises, Problems, and Projects 15.7.1 Multiple Choice Exercises 15.7.2 Compute the Running Time of a Method 15.7.3 Programming Projects 15.7.4 Technical Writing 15.7.5 Group Project (for a group of 1, 2, or 3 students) Appendix A Java Reserved Words and Keywords Appendix B Operator Precedence Appendix C The Unicode Character Set Appendix D Representing Negative Integers Appendix E Representing Floating-Point Numbers
  • 35. Appendix F Solutions to Selected Exercises Index
  • 37. Purpose of This Text and Its Audience Java Illuminated, Fifth Edition, covers all of the material required for the successful completion of an introductory course in Java. While the focus is on the material required for the Computer Science I (CS1) and Computer Science II (CS2) curricula, students enrolled in Information Systems, Information Technology, or self-directed study courses will find the text useful as well. It has been written to provide introductory computer science students with a comprehensive overview of the fundamentals of programming using Java as the teaching language. In addition, the text presents other topics of interest, including graphical user interfaces (GUI), data structures, file input and output, and graphical applications. Throughout the text, we take an “active learning” approach to presenting the material. Instead of merely presenting the concepts to students in a one-sided, rote manner, we ask them to take an active role in their understanding of the concepts through the use of numerous interactive examples, exercises, and projects.
  • 38. Coverage and Approach Our approach is to teach object-oriented programming in a progressive manner. We start in Chapter 1 by presenting an overview of object-oriented programming. In Chapter 3, we delve a little deeper into the concepts of classes and objects and introduce the student to many of the useful classes in the Java Class Library. Our emphasis at this point is on using classes; we teach the student how to read APIs in order to determine how to instantiate objects and call methods of the classes. In Chapter 7, we move on to designing user-defined classes, and in Chapter 10, we present inheritance, polymorphism, and interfaces. Throughout the text, we present concepts in an object-oriented context. Our philosophy is to emphasize good software engineering practices by focusing on designing and writing correct, maintainable programs. As such, we discuss pseudocode, testing techniques, design trade-offs, and other software engineering tips. We teach the student basic programming techniques, such as accumulation, counting, calculating an average, finding maximum and minimum values, using flag and toggle variables, and basic searching and sorting algorithms. In doing so, we emphasize the patterns inherent in programming. Concepts are taught first, followed by fully implemented examples with source code. We promote Java standards, conventions, and methodologies.
  • 39. What’s New in Java Illuminated In this edition, we have incorporated the latest features of Java in Java 8 and Java 9: the jshell sandbox, Streams, functional interfaces and lambda expressions, the use of default methods in interfaces, JavaFX graphics, using FXML in JavaFX applications, tying a JavaFX GUI component to data in a Collection, JavaFX animations, and the StackWalker class. We have converted all graphics examples and graphical Programming Activities to JavaFX. Throughout the book, we updated, improved, and replaced examples. In Chapter 1, we added instructions for making a JAR file. In Chapter 2, we use the Java 9 jshell sandbox to demonstrate the definition of variables, assigning of values to variables, and the results of performing arithmetic calculations. In Chapter 3, we augmented the existing example on Strings with more explanations of Strings methods, and added another example with illustrations to demonstrate Strings Processing techniques. In both examples, we emphasize sending arguments to methods and receiving return values. We converted Chapter 4 to JavaFX. To make it easier for the students to write JavaFX applications, we provide a utility class that encapsulates the overhead code to create a window. As a result, the students can concentrate on calling methods of the GraphicsContext class. We provide an online
  • 40. version of the Swing version of Chapter 4 from the 4th edition for those instructors who prefer the Swing graphics system. In Chapter 7, we modified mutator methods to change instance variable values only if the parameter value is valid. Otherwise, the instance variable value is unchanged and we no longer output an error message. After we introduce the implicit reference, this, we implement the standard Java coding style of defining parameters with the same name as the instance variable. Further, we allow mutator methods to be chained by returning a reference to the object being modified. We have also moved the material on creating packages to an online supplement. In Chapter 10, we converted the polymorphism example to JavaFX. We revised our existing interface example to use a default method and added an example demonstrating polymorphism with interfaces. In Chapter 11, we added sections showing how to read file data into a Stream, and then filter and process that Stream using lambda expressions. We also added an example that reads and parses JSON data from a remote location on the Internet. We converted Chapter 12 from Swing to JavaFX (the Swing version of Chapter 12 from the Fourth Edition is now available online). We added how to define a View using FXML, as well as programmatically, how to process touches, how to tie a GUI component to a Collection so that it is automatically updated as the data changes using ObservableLists, how to play sounds, and how to perform animations using JavaFX.
  • 41. We explain how to write event handlers using lambda expressions. In Chapter 13, we use the StackWalker class to illustrate the state of the stack as recursive calls are made.
  • 42. Learning Features Recognizing today’s students’ growing interest in visualization, we distribute techniques for producing graphical output throughout the book, starting in Chapter 4 with graphical applications. An example using either animation or graphical output is included in most chapters. Instructors who are not interested in incorporating graphics into their curriculum can simply skip these sections. In addition, some of our examples are small games, which we find motivational for students. In each chapter, we include one or two Programming Activities, which are designed to provide visual feedback to the students so that they can assess the correctness of their code. In most Programming Activities, we provide a framework, usually with a graphical user interface, to which the student adds code to complete the application. The student should be able to finish the Programming Activity in about 15 to 20 minutes; thus, these activities can be used in the classroom to reinforce the topics just presented. Each Programming Activity also includes several discussion questions that test the student’s understanding of the concepts the activity illustrates. The Programming Activities are also appropriate for a closed or open laboratory environment. In short, this text can be used in a traditional lecture environment, a computer-equipped classroom, or a lab environment. In addition, we supplement each chapter with a browser- based module that animates sample code, visually illustrating concepts such as the assignment of variable values, evaluation of conditions, and flow of control.
  • 43. We also provide the instructor and students with an extensive variety of end-of-chapter material: multiple-choice questions, examples that ask the student to predict the output of prewritten code or to fill in missing code, debugging activities, short exercises, programming projects, technical writing assignments, one or more learning-to-learn exercises called Look It Up, and a higher-difficulty group project.
  • 44. Chapter-by-Chapter Overview The chapters are logically organized from simple to more difficult topics, while incorporating object orientation as needed, taking into account the specifics of the Java language. Here is a brief summary of the topics covered in each chapter: Chapter 1: Introduction to Programming and the Java Language We introduce the student to the concept of programming, first covering computer hardware and operating systems, and following with a brief evolution of programming languages, including an introduction to object-oriented programming. We explain programming basics and pseudocode as a program design technique. The student writes, compiles, and debugs their first program using an integrated development environment. Chapter 2: Programming Building Blocks—Java Basics In this chapter, we concentrate on working with variables and constants of primitive data types and composing arithmetic expressions. We illustrate the differences between integer and floating-point calculations and introduce operator precedence. We introduce jshell, the programming sandbox now available with Java 9. We use a combination of jshell sessions and complete programs to demonstrate the concepts at hand.
  • 45. Chapter 3: Object-Oriented Programming, Part 1: Using Classes Chapter 3 introduces classes from the user, or client, standpoint and discusses the benefits of encapsulation and code reuse. The student learns how to instantiate objects and call methods. We also demonstrate useful Java classes for console input and output, formatting output, performing mathematical calculations, generating random numbers, and using methods of the Wrapper classes. We use methods of the String class to visually illustrate the passing of arguments and receiving of and use of return values. Chapter 4: Introduction to Graphical Applications Chapter 4 presents several methods of the JavaFX GraphicsContext class that can be used to create graphical output by drawing shapes, text, and sprites. The windowing graphics coordinate system is explained and using color is also explored. We demonstrate these graphics methods in JavaFX applications. Instructors wishing to postpone or skip graphics coverage altogether can use as little or as much of this chapter as they desire.
  • 46. Chapter 5: Flow of Control, Part 1: Selection Various forms of the if, if/else, and if/else if statements are presented, along with the appropriate situations in which to use each form. We also demonstrate nested if/else statements and testing techniques. We begin our coverage of scope by introducing block scope. Later chapters build upon this foundation. As part of our object-oriented programming coverage, we teach the importance of comparing objects using the equals method. This chapter also covers the conditional operator and the switch statement.
  • 47. Chapter 6: Flow of Control, Part 2: Looping This is probably the most important chapter in the book. We have found that looping and repetition are the most difficult basic programming concepts for the average student to grasp. We try to ease the student’s understanding of looping techniques by presenting patterns to follow in coding basic algorithms: accumulation, counting, calculating an average, and finding minimum and maximum values. Looping is further explored as a tool for validation of input values. We also introduce toggle variables and flag variables as tools to facilitate writing loops. We continue our coverage of scope by illustrating the scope of variables declared within the while loop body and for loop header. We concentrate on using the while loop for event-controlled and sentinel-controlled repetition and the for loop for count-controlled looping. A large section focuses on constructing loop conditions, which is often a challenging task for the student. Sections are also provided on testing techniques for loops. In this chapter, we also introduce reading data from a text file using the Scanner class.
  • 48. Chapter 7: Object-Oriented Programming, Part 2: User-Defined Classes In this chapter, we teach the student to write classes, as well as client applications that instantiate objects and call methods of the class. We present class design techniques and standard patterns for writing constructors, mutators and accessors, and the toString, equals, and other user-defined methods. We further explain scope in the context of class members and method parameters. We also explain how to write classes with static methods and static data. Additionally, we illustrate how to write methods so that the method calls can be chained. Enum is also covered as a user-defined class type. Finally, we teach the student how to use Javadoc. Chapter 8: Single-Dimensional Arrays This chapter begins with the declaration, instantiation, and initialization of single-dimensional arrays. From there, the student learns to perform the basic programming techniques (accumulation, counting, calculating an average, and finding maximum and minimum values) on array elements. We also cover arrays as instance variables of a class, and demonstrate maintaining encapsulation while accepting arrays as method parameters and returning arrays from methods. We demonstrate how to represent an array as a bar chart. Basic searching and sorting algorithms are also presented, including sequential and binary searches and Selection and Insertion sorts.
  • 49. Chapter 9: Multidimensional Arrays and the ArrayList Class We focus in this chapter on two-dimensional array processing, including techniques for processing the elements in the entire array, or the elements in a specific column or row. We also demonstrate the extra processing needed to handle arrays with rows of different lengths. Creating a bar chart of the data in the array is also demonstrated. In addition, we extrapolate the concepts from two-dimensional arrays to discuss multidimensional arrays. We present the ArrayList class as an expandable array and demonstrate using classes with generic types, the enhanced for loop, and autoboxing and unboxing.
  • 50. Chapter 10: Object-Oriented Programming, Part 3: Inheritance, Polymorphism, and Interfaces Continuing our object-oriented programming coverage, we discuss the important concepts and benefits of inheritance and the design of class hierarchies, including abstract classes. We cover inherited members of a class, constructing objects of a subclass, adding specialization to a subclass, overriding inherited methods, and calling methods of the superclass. We discuss the trade-offs of declaring members as protected versus private. We demonstrate polymorphism with a graphical example. We introduce the student to interfaces, emphasizing code reuse as the motivation for defining interfaces. We explain default methods and how we can use them in new versions of a program so that our old code does not break as we add new features. We also demonstrate polymorphism using interfaces. Interfaces are used extensively in Graphical User Interfaces (See Chapter 12.) We introduce UML diagrams to help students visualize the inheritance hierarchy of the examples.
  • 51. Chapter 11: Exceptions and Input/Output Operations Recognizing that building robust applications requires error handling, we present exception handling as a tool for validating user input and recovering from errors at run time. We demonstrate handling predefined exceptions and writing user-defined exceptions. With this knowledge, the student is ready to perform file input and output operations. We demonstrate reading and writing Strings and primitive data types to text files, and reading and writing objects directly to files. The Scanner class is used to read and parse input from text files and Strings. We demonstrate how to read and place file contents into a Stream and how to filter and process that Stream. We use lambda expressions when processing the Stream. We demonstrate how to read data from a remote file located on the Internet, including parsing JSON data and converting that data into a Stream for filtering and processing.
  • 52. Chapter 12: Graphical User Interfaces Using JavaFX This chapter introduces the student to event-driven programming and writing event handlers for text fields, buttons, radio buttons, checkboxes, combo boxes, sliders, and mouse and touch activities. We also demonstrate panels and several layout managers for organizing GUI components, as well as how to nest components. In our examples, we illustrate how to separate the graphical user interface code from the underlying data and program logic using the Model- View-Controller architecture. We demonstrate how to use FXML to define a View, and we also show how we can define a View programmatically. Showing bar charts and pie charts, we demonstrate how we can use Collections with JavaFX components so that the GUI is automatically updated when its model (a Collection) is changed. We explain how to write lambda expressions and use them throughout the chapter. We demonstrate how we can use the various animation classes of JavaFX to animate a sprite, including performing sequential and parallel animations.
  • 53. Chapter 13: Recursion Recursion is presented as a design technique, reducing the size of a problem until an easy-to-solve problem is reached. We demonstrate recursive methods with one base case and with multiple base cases, and with and without return values. Specific examples provided include computing the factorial of a number, finding the greatest common divisor, performing a binary search, determining if a phrase is a palindrome, calculating combinations, and solving the Towers of Hanoi problem. We use the StackWalker class to demonstrate how values are pushed onto and popped off the stack as recursive calls are executed. The benefits and trade-offs of recursion versus iteration are also discussed. Chapter 14: An Introduction to Data Structures In this chapter, we cover data structures by exploring the concepts and implementations of various types of linked lists, stacks, and queues. We demonstrate many types and uses of linked lists: a singly linked list, a linked list as a stack, a linked list as a queue, a doubly linked list, a sorted linked list, and a recursively defined linked list. Arrays as stacks and circular arrays as queues are also covered in detail. We begin with a list of primitive types (int) and progress to a list consisting of objects of a user-defined Player class. Then we cover defining a class using generic types to demonstrate how a list can be defined to hold generic objects.
  • 54. Chapter 15: Running Time Analysis We explain how to evaluate the performance of an algorithm in this chapter. We explain the Big-Oh notation and orders of magnitude. Students learn various methods for deriving performance estimates: counting statements in loops, iterative, handwaving, and proof by induction analyses for recursive methods. We demonstrate how the coding of an algorithm influences its running time. Worst-case, best-case, and average-case performances are explained and illustrated.
  • 55. Discovering Diverse Content Through Random Scribd Documents
  • 56. CHAPTER XVI SAINT MARTIN'S SUMMER One of the quiet evenings, the two men were playing chess and Daffodil was watching them; Susan came in and said in her most respectful manner: "A gentleman wishes to see Miss Carrick. Here is his card." Daffodil took it and read, "Archibald Langdale, M.D." "Oh," in a glad, girlish tone, "it's my old friend, Archie, that I haven't seen in ever so long. Dr. Langdale;" with a pretty assumption of dignity. "Yes." "And, uncle, you must see him. Not that I want you to accept him for a family physician, for really I don't know what he is like. He may be the veriest prig;" and she gave a dainty half laugh. "If he is spoiled it will be the fault of your city, he was very nice at Pittsburg. And you, too, Mr. Bartram." "I have met the young man. I didn't see that he was much puffed up with his honors." "Thank you." She made a fascinating courtesy. How pleased she was, he could see that.
  • 57. "We will soon be through with the game. Yes, I'll come," said M. de Ronville. She would hardly have known Archie. He stood up straight and he was quite as tall as Ned. He had filled out somewhat, though he was still rather thin, but his face had lost that deprecating expression, and had a clear notion not only of truth and honor, but of his own power as well. It was a tender face also, with the light in it that draws one unconsciously. The eyes seemed to have grown darker, but the hair was light as in boyhood. "I am so glad to see you again;" and he took both hands in a warm clasp. "I couldn't wait until some accidental meeting, where you might kindly invite me for old friendship's sake." "That would not have been worth while. I have heard about you, and I wondered if you had outgrown childish remembrances." "You would bring them all back if I had. How little you have changed, except to grow tall. And now tell me about yours and mine. Once in a great while Ned writes, and mother doesn't seem to have the gift of chatty letters. Hers are mostly about my humble self, her son rather, and how he must avoid certain things and do other certain things, and not grow hard-hearted and irreligious and careless of his health;" smiling with a touch of tenderness. "So, you see, I do not hear much about the real Pittsburg." "Oh, you would hardly know it now, there are so many changes, and so much business. New streets, instead of the old lanes, and the old log houses are fast disappearing. We are making real glass, you know, and there is talk of a paper mill. And nearly all the girls are married; the older ones, I mean. Families are coming in from the country, others go out to Ohio and Kentucky. Why, it is a whirl all the time." "I'd like to see it and mother. I've planned to go several times, but some study or lectures that I couldn't miss would crop up. And it
  • 58. takes so much time. Why doesn't some one invent a quicker way of travelling? Now, if we could fly." "Oh, that would be just splendid!" eagerly. "I used to watch the birds when I was a boy, and flying seemed so easy for them. Now, why can't some one think up a pair of wings that you could slip on like a jacket and work them with some sort of springs, and go sailing off? I'm learning to put people together, but I never was any hand for machinery." "Oh, think of it! A winged jacket;" and they both laughed gleefully. Then M. de Ronville entered and expressed his pleasure at meeting the young man, who was already distinguishing himself, and who was an old friend of Miss Carrick. "Not that either of you are very old," he commented smilingly. Mr. Bartram he recalled. And certainly the generally quiet student talked his best. Was Daffodil a sort of inspiration? Was that one of the graces of early friendship? He apologized presently for his long stay. He so seldom made calls, that he must plead ignorance of the correct length, but he had enjoyed himself very much. And then M. de Ronville invited him to drop in to tea. He would like to discuss some new medical methods with him. "A very intelligent, well-balanced young man," the host remarked. "If the other one is as sensible, they are sons to be proud of." "Their mother is proud of them, but their father would rather have had them in business," said Daffodil. Belinda Pemberton was quite fascinated with Daffodil. "You are such a sweet, quaint, honest little thing," she said, "and you do make such delightfully naïve remarks. And Arthur declares you must have learned to dance in fairyland."
  • 59. "I think I did," she returned gayly. "And I do love it so." Then the little circle, and the wider one, had a fine surprise. Betty Wharton, now Madame Clerval, returned quite unexpectedly, as her husband had resigned his position. "I had quite enough of Paris," she said to a friend. "One wants an immense fortune to truly enjoy it. And somehow things seem shaky. Then, too, one does have a longing for home when one gets past youth." So she opened her house and set up a carriage. Monsieur Clerval found himself quite in demand by the government, as the country needed a multitude of counsellors. She came in to see M. de Ronville, who gallantly said she had renewed her youth, and begged for the secret. "It is simply to keep young, to resolve not to grow old;" with a gay emphasis. "But time passes, my dear lady." "And where is that pretty, golden-haired Daffodil?" she enquired. The girl was summoned. Yes, she had outgrown childhood, but there was a delightful charm in her young womanhood. "We were such friends—if you can remember so far back." "And you were so good to me, and made everything so enjoyable. Wasn't I very ignorant?" "You were very frank, and honest, and adaptable. So we must take up the old intimacy again. M. de Ronville, I shall drop in often and say, 'Lend me your daughter for this or that occasion.' Or is it your niece? And if some one falls in love with her you must not scold me. Young men have eyes, and really, I am too kindly-hearted to throw dust in them."
  • 60. Daffodil turned scarlet. "Is it quite right to go about so much?" she said to M. de Ronville afterward, and the tone had a great uncertainty in it, while the curves of her pretty mouth quivered. "For you know——" He drew her down beside him on the sofa. "I thought some time we would talk it over—your unfortunate marriage, I suppose, comes up now and then to haunt you. Yet, it was fortunate, too, that the explanation came just as it did. I honestly believe it was an ignorant child's fancy. You were not old enough to understand real love. I think he could hardly have been a thorough villain, but an incident like this has happened more than once. And I truly believe you have overlived it." She shuddered, and her eyes were limpid with tears. It was good to feel his friendly arm about her. "It is like a dream to me, most of the time. And I think now, if he had made a passionate, despairing protest, it would have gone much harder with me. But it was right for him to go away when his father sent, and he was the next in succession to Hurst Abbey. And there was his child, his boy. I could never have been his true wife, but it hurt to be given up so readily, yet it was best. It gave me courage. And what if he had tired of me later on? They all helped me to bear it. And there was the deception. For if he had told the truth, there might have been pity, but no love." "It was a sad thing to happen. My heart ached for you. But you know, Daffodil, you never were a wife in the true sense of the word. You are quite free, you have always been free. And you must feel so. You must not carry about with you any uncertainty. It is something buried fathoms deep, that you need never draw up to the surface, unless in time to come you tell the story to the man you marry." "I shall never marry," she returned gravely. "I have it all planned. Felix shall have the fortune, for what could a woman do with it in
  • 61. her own hands? And he has the name, he has only to leave off the Carrick. And it shall be my business to make every one as happy as I can. And if it is not wrong to take pleasure for myself—I do love joy and happiness, and I could not grieve forever, when I knew the thing I would grieve for was wrong." There were tears dropping off the bronze lashes, but she was not really crying. He pressed her closer. There was an exquisite depth to her that did not often come to the surface. "So you have it all planned for the years to come," he returned after a moment or two. "That is quite far off. Meanwhile you must have a good time with other young people. That will make me the happiest, if you care for me." "Oh, indeed I do, indeed I do," she cried earnestly. Then, after quite a pause, she continued— "I almost lost sight of what I wanted to ask. It was whether I ought to explain anything, whether it would be sailing under false colors when no one knew;" and she gave a tangled sort of breath that she would not allow to break into a sob. "My dear child, there would be no use in explaining what could only be a matter of gossip. I think, nay, I am certain, Aldis and myself are the only ones who know, and if there had been any trouble I should have sent him to your assistance. I dare say, some of your friends and neighbors at home have wellnigh forgotten about it. And now, do not let it disturb you, but be as happy as God meant you should be, when He snatched you from the peril." "Oh, thank you," she rejoined with a grateful emotion that he felt quiver through her slender body. She wondered if she was too light-minded, too easily pleased. For every joyous thing seemed to come her way. The girls sought her out, the young men wanted to dance with her, and were willing to bore themselves going out to supper, if they knew she would be
  • 62. there. It was not because she was brighter or wittier than the others, or could think of more entertaining plays, but just that she seemed to radiate an atmosphere of happiness. She did not give up all her time to pleasure. She drove with her guardian on pleasant days; he had left off riding now, but he sent her out occasionally with Mr. Bartram, lest she should get out of practice, he said. Then she read to him, or they took up French. She made merry over her blunders. The autumn was long and warm. They sat in the garden in the sunshine, or walked up and down. Now and then he went to the office, when there were some important matters on hand. Madame Clerval gave a dance after she had her house set in order. It might have been called a ball. It was mostly for the young people; she was just as fond of them as ever, and secretly admitted that she didn't enjoy prosy old people, who could talk of nothing but their pains and aches, and how fast the country was going to ruin. "Do you think Mr. Bartram would consider it a nuisance to come for me?" she asked of her guardian, with a face like a peony. "Why, no, child. Madame made quite a point of his coming. He is growing old too fast." "Why, he isn't old," she said rather indignantly. "And you see—it's hard sometimes not to offend this one or that one, and if he is really coming, will you ask him to bring me home? Wouldn't you prefer it?" "I think I would;" very gravely, though he wanted to smile. Wetherell and Arthur Pemberton were pushing each other for her favors, and she tried to distribute them impartially. The dance was a splendid success, and the dainty supper had a French air. Mr. Bartram came in just before that. Daffodil was engaged, of course. Madame provided him with a charming partner.
  • 63. There was only a galop afterward. At private affairs it was not considered good taste to stay after midnight. Mr. Bartram made his way to Daffodil, and asked her if she was ready to go, and she nodded gracefully. She looked so pretty as she came down the stairs, wrapped in something white and fleecy, smiling on this side and that. "It was very enjoyable," he said, "at least to you young people. I'm not much of a dancer nowadays, so I didn't come early." "It was just full of pleasure. Madame Clerval always plans admirably." He smiled to himself. Most girls would have protested about his being late, even if they had not specially cared. The young people took up the habit of calling in the evening, three or four of them, sometimes half a dozen. Mrs. Jarvis would send in some cake and nice home-made wine, which was quite a fashion then. They made merry, of course. "Dear uncle," she said one morning, it was raining so they couldn't go out, "didn't we disturb you last evening with our noise and laughter? I don't know why they are so eager to come here, and think they have a good time, for I am not as full of bright sayings as some of the girls. And if it annoys you——" "My child, no. I lay on the sofa and listened to it, and it almost made me young again. I had no merry youth like that. Oh, am I coming to second childhood?" His eyes were bright, and she thought she had never seen them so merry, save at first, when he had laughed at some of Felix's pranks. And his complexion was less pallid, his lips were red. "Then second childhood is lovely. And you have grown so interested in everything. You don't get tired as you used. Are you real happy, or are you doing it just to make me happy?"
  • 64. She gave him such a sweet, enquiring look, that he was touched at her solicitude. "It is both, I fancy. You see, last winter I was ill and alone a great deal. I missed Betty Wharton, who was always flying in with some fun, or a bright story that had been told. Aldis had all the business to attend to, and sometimes wrote in the evenings. Time hung very heavy on my hands, and I began to think it was time for me to go hence. And by spring I had quite lost heart, though I began to crawl about a little. And I kept thinking how I should live through another dreary winter, and be half sick. It kept looming up before me. Then I thought I ought to settle something about your business when your father wrote concerning the lease. You came into my mind. I thought how brave you had been through that unfortunate time, and wondered if you would not like a change. I wanted some one to bring in the sunshine of youth, and you had spent so many of your years with elderly people, I thought you must have some art. I could make it pleasant for you, and the reflected light would brighten me. So I begged a little of your sweet young life." "I am glad if it has made you happy," she said, much moved. "It has given me new zest, it has made me almost well. True, I have had some twinges of my old enemy, rheumatism, but they have not been severe. I have not been lonely. There was some pleasure within my reach all the time. Oh, old people do want a little of the sun of youth to shine on them. And if you had no dear ones at home, I should keep you always, golden-haired Daffodil." She took his hand in hers, so full of fresh young life. "And I should stay," she said. "So, do not think your little merry-makings annoy me at all. I am glad for you to have them, and next day it is like reading a page out of a book, a human book that we are apt to pass by, and say we have no pleasure in it, but it is what we need, and what we want,
  • 65. down in our very heart of hearts, but often we are ashamed to ask for it." It was true, he was much better. The house was losing its grave aspect. Jane had been used to flinging about wise old saws, and comparisons, and finding things to enjoy; Susan was quiet, falling into routine, and staying there until some new duty fairly pushed her out in another direction. She had no sense of humor or enthusiasm, yet she performed all the requirements of her place with ease and industry. Mrs. Jarvis was just as kindly solicitous as ever, but intellectually there was a great gulf between her and M. de Ronville. She entertained whatever guests came with an air of precision, never forgetting she was a higher sort of housekeeper. She enjoyed the quiet of her own room, where she sewed a little, and read a good deal, the old-fashioned English novels, such as "Children of the Abbey," "Mysterious Marriage," "The Cottage on the Cliff," and stories of the latter half of the century. She thought it no part of a woman's business to concern herself with politics, she would have preferred living under a real King and nobility, but she accepted the powers that ruled, and stayed in her own little world, though she, as well as M. de Ronville, enjoyed the stir and interest that Daffodil brought about. After Madame Clerval came, there was more variety and gayety in Daffodil's life, and she helped to rouse M. de Ronville as well. Then came a reception at the Presidential mansion. "Of course, you will go," Madame said to him, in her persuasive, yet imperious, manner. "We must not be a whit behind those New York people in the attention we pay our President. And one need not stay the whole evening through, you know. You will meet so many old friends. Come, I cannot have you getting old before your time." "But I am an old man," he protested.
  • 66. "In our new country we must not get old. It is to be the land of perennial youth," she answered gayly. Aldis Bartram joined his persuasions as well, and M. de Ronville went almost in spite of himself. He had kept his delicate, high-bred air and French atmosphere, and looked well in the attire of that day, with his flowered waistcoat, his black velvet suit and silk stockings, with a jewelled buckle on his low shoes. His beautiful white hair was just tied in a queue, with a black ribbon. There was something dignified and gracious about him, and friends thronged around to congratulate him. And though he had seen Washington in many different phases of his eventful life, he had not as yet met him as President of the nation he had fought for and cemented together. There were handsomer girls than Daffodil; indeed, the fame of the beauties of Philadelphia in that day has been the theme of many a song and story. But she was very pretty in her simple white frock that in the fashion of the day showed her exquisite neck and shoulders, though the golden curls, tied high on her head, shaded and dazzled about it in a most bewitching manner. Madame Clerval was wise, she was not trying to outshine any of the belles, yet there was a bevy of young men about her constantly, and most devoted to her and to M. de Ronville, was Dr. Langdale. In fact, he was really the favorite visitor at the house. He ran in now and then with news of some new book, or some old translation, and a talk of the progress of the library and the trend of general education. Why should Boston have it all? Or a new medical discovery, though he was in no sense M. de Ronville's physician. Was it strange that both these young people, having passed their childhood in Pittsburg, should come to a nearer and dearer understanding? Aldis Bartram watched them with the sense of a new revelation. Yet he could not subscribe to it cordially. The medical enthusiast was hardly the one he would choose for a girl like Daffodil. Arthur Pemberton would do better, yet he was not quite up to her mark. She was a simple seeming girl, yet he was learning that she had a great deal of character and sweetness. Somehow she kept
  • 67. herself curiously enfranchised from lovers. Her friendly frankness gave them a status it was difficult to overcome. "I never expected to enjoy myself so much again," said M. de Ronville, when they were in the carriage. "It is an excellent thing to go on moving with the world, to keep in touch with the things that make up the sum of life, instead of feeling they belong to the gone- by time, and you have no interest in them." How much like his olden self he was, Aldis Bartram thought. He wondered if he had been at fault in letting him drop down. There was much perplexing business, and he had hated to bother the elder man with it. Sometimes it seemed tedious to explain. Had he grown selfish in certain ways, preferring to take the burthen, rather than the trouble of sharing it with another? He had much personal ambition, he was in full earnest of a man's aims and life purposes. Yet it was this man who had helped him to the place whereon he stood, and it was not honorable to crowd him out under the plea that his best days were over. It seemed, indeed, as if days fairly flew by, there was so much crowded in them. When the morning was fine, Daffodil insisted they should drive out. It was delightful to keep bowing and smiling to friends, with this attractive girl beside him. He went to some meetings of the Philosophical Society, and he took a new interest in the Library plans. "You certainly have worked a transformation," Bartram said to Daffodil, when M. de Ronville consented to go to a concert with them, to hear two remarkable singers, who had come from abroad. "You will have to stay. Didn't I hear you discussing Pittsburg with Mrs. Jarvis?" "Oh, they are longing for me to return. And in two days March will come in, that will be spring. And I was only to stay through the winter."
  • 68. "But March is a cruel and deceitful travesty on spring. February has been too short." "But they want me. And, yes, I want to see them all, and the garden, and the woods, and what new things have happened to Pittsburg. For there is something new coming in all the time." Her face was so eager and full of happy interest. "Well—I don't know what we shall do without you"; and the inflection of his voice was disconsolate. "I am afraid we shall fall back to the old routine. I am a busy man, you know, and have to shoulder a great many cares not really my own. Perhaps, too, I haven't the divine art of making a house bright, a woman's province." "Oh, Mr. Bartram, I will tell you;" in a clear, earnest tone. "Why do you not marry, and bring some one here to do it? There are so many charming girls, sometimes I feel quite unimportant and ignorant beside them." She uttered it in the same manner she might have asked why he did not bring home some flowers to grace the study table. Her lovely eyes were raised to his in the utmost innocence, and not a tint of color wavered on her cheek. His flushed with sudden surprise. "Perhaps the charming young girl would consider it a dull house for life, and then elderly people have whims and fancies—well, younger men do. I have myself. And it would be asking a good deal." "I think uncle hasn't many whims, and he does keep them in the background. You almost have to watch for them. Why, think of grandad!" and she laughed with a soft musical sound. "What he liked yesterday he may not like at all to-day, so Norry does the new thing, and says nothing about the other. And he often disputes with father as to whether there was any real need for the war, and that we would be better off under King George. But uncle is so large- minded, and then he has so many refined and delightful tastes. But
  • 69. you would get lonesome if you were not very well, and no one came to cheer you up, or bring you new thoughts and bright bits of things, that were going on in the world outside." She paused suddenly, and flushed like a culprit, looking more beguiling than ever, with her downcast eyes. "I suppose I oughtn't have said it, but it seems true to me, only I'm not blaming you. You have a great many things to attend to, and you must do them in a man's way, devote your whole mind to them, and you can't be frivolous, or other people's business would suffer. If I hadn't any one I would come and stay, but—I love them, and sometimes, in spite of the pleasure, my heart is almost torn in two with the longing. I said I would come back in the spring, and I must go. Then it will not be quite so bad, for Madame Clerval will be in and out, and he is so much better. And you'll let him take an interest in business, when he feels like it—oh, I seem to be giving you advice, and I sincerely beg your pardon. After all, I am not much more than a little girl, and I am talking as if I was old and wise;" and a sudden shame flamed her cheeks with scarlet. "I think you have been wise, and sweet, and patient, without growing old. You have done a great deal for your guardian this winter—I really was afraid we should not have him with us for very long, and he did seem to wish for you so. Perhaps we were selfish, he and I." "Oh, I was ready to come, too. It has been a delightful winter, and everybody has been so good to me, I've been just full of pleasure. But when you love those you have left behind, you sometimes feel as if you could fly." She winked very fast, then made a sudden dab at her eyes, and half laughed, too. "I think I understand. I have had no one to love dearly since I was a little lad, and all I remember about my mother is that she was pale, and ill, and could not endure a noise. Then I was put in school, and
  • 70. my father went away and died. When I was eighteen I went in M. de Ronville's office, and finished my studies. He has been my best friend, really like a father to me. I ought to make all the return in my power." "Oh;" and there was a bewildering sweetness in her tone. "I have been so happy most of my life, and had so many to love me." Then that unfortunate episode had not cost her any deep-seated grief. Had she loved at all, or was it only a childish fancy? He hoped it was, for the sake of her future. He turned then and went out of the room. M. de Ronville had been up in his dressing-room, with his valet, and now he went to the library, and she followed him. There were some reports to look over, then the carriage came for them. It was sunny, with very little wind, and they had plenty of wraps. Aldis Bartram went his way to the office. The two clerks were there and busy. He opened his letters, and answered several, the others had need of some legal opinions to be looked up. Then he took up a rather complicated case, but he soon lost the thread of it, for Daffodil's almost upbraiding voice haunted him. He had been outwardly patient many a time when all was irritation within, for he was too manly and too really grateful to show impatience. Had Daffodil's being there this winter proved the source of the reaction in M. de Ronville's health? Had loneliness intensified the disease and discomfort? Perhaps. And now two or three young men dropped in, and had entertaining talks with him. Or was it because they liked the byplay of the pretty, vivacious girl, who never made herself the first attraction. "Marry some pretty, charming young girl!" Where would he find one to M. de Ronville's liking?
  • 71. CHAPTER XVII OH, WHICH IS LOVE? March opened cold and stormy. Rheumatism made a clutch at M. de Ronville. For several days he did not come downstairs, but insisted that some of the guests must come to him. Dr. Langdale skipped away from a lecture he really desired to hear, and spent an hour comforting the invalid. Madame Clerval came in with a budget of news and friendly gossip, and Daffodil talked of her little girlhood, and old Pittsburg, as they had begun to call it, and sitting on the arm of great-grandfather's chair, and listening to tales of a still older time. He did not wonder that his friend Duvernay had lived to be almost a hundred, with all that affection to make the way pleasant. Then he improved and came downstairs, took up chess-playing, and little promenades on the porch when the sun shone. And then the talk veered round to Daffodil's departure. He would not hear anything about it at first. "Yet we have no right to keep her away from her own household, when she has been brave enough to give up all the winter to us," Mr. Bartram said. "Oh, no, I suppose not. If I was younger, or in assured health, I should go and spend the summer with them. Oh, don't look so startled. I know it wouldn't do, with my uncertain health."
  • 72. Aldis smiled. "If the summer is fine, and you keep pretty well, we might both take a trip. I would hardly trust you to go alone." "So we might." The elder was gratified with the consideration. "Aldis?" presently, in a half-enquiring tone. "Well?" glancing up. "Do you think—that Dr. Langdale—that there is anything between him and Daffodil?" "There has been some talk. But young Pemberton is devoted to her as well." "With either she would have to come back here to live. I like the doctor. He is such a fine, large-hearted, sympathetic young fellow, with so much real charity for suffering. I seem to be envying other people's sons and daughters;" ending with a longing sound. "Yes, if she were in love with him." Aldis Bartram experienced a feeling of protest. Yet, why should he object? They were both young, they had been friends from childhood, and he was certainly worthy of her. That very evening he dropped in. There had been a wonderful surgical operation on a poor fellow, who had been mashed and broken by a bad fall. There had been a dispute at first, whether they could save him intact, but after hours of the most careful work there was a good chance. Dr. Langdale was so proud and enthusiastic, giving every one his due with no narrowness. Then he said, "Oh, Daffodil, are you really going home?" "They have sent for me. The winter has gone!" and there was a piquant smile hovering about her face. "It has been such a short winter I have not done half the things I planned to do. But I am resolved to run away some time in the
  • 73. summer. It is ungrateful not to visit mother. And I do want to see the town, and all the old friends." "Oh, do come!" There was a joyous light in her eyes, and a sweetness played about her lips. Yes, he surely thought he would. Then they went on about other matters. Bartram was not much versed in love indications, but something rose within him—as if there should be a higher, stronger, more overwhelming love for her. She would make them talk cheerfully about her going. She said sagely there was such a thing as wearing out one's welcome, and that now she should feel free to come again. "Next winter," said her guardian. "I think I can get along through the summer with this thought to sustain me, but I shall be a year older, and perhaps more feeble." "I strictly forbid either of the consequences;" she laughed with adorable gayety, her eyes alight with fun. "One would think I was of great consequence," she exclaimed a few days later, "by the lamentations my friends make. Or is it a fashion? It will make it harder for me to go. If we could move Pittsburg over! But there are the splendid rivers, and the hills covered with rhododendrons. And, you see, I shall miss the daffodils." "If it is such sorrow to part with one, I hardly know how you can endure losing so many," said Aldis Bartram gravely. She looked at him enquiringly. He seldom paid compliments to any one but Madame Clerval. There were bloom and beauty enough in the grand old town, where every point was romantic. Every day Daffodil and her guardian were out driving, until it seemed to her she could have found her way about in the dark. And in his office Aldis Bartram sat thinking how lonely the house would be without the sunshine of her golden head,
  • 74. and the sound of her sweet, merry voice, her small, thoughtful ways, and the ease with which she could change from one mode of action that she saw was not bringing about a desirable result. At first he considered this a sort of frivolity, but he understood presently that she not infrequently gave up her own pleasure or method for something that suited M. de Ronville better. He was ambitious, and he had marked out a career for himself. He meant to be rich and respected, his instincts were all honorable, and this had commended him to his employer, who detested anything bordering on double dealing. So, from one position he had been advanced to another, and by persistent study had taken his degree with honor. He enjoyed the life of the class with which he was in keen touch, and he found he could maintain a degree of mental superiority that satisfied his ambition. There had been a partnership; he was junior counsel, and some of the clients preferred the young, broad-minded man. Then had come the proffer of a home that really surprised him. There were no relatives to be jealous; why, then, should he not be as a son to this man, who no longer felt equal to the burthen and heat of the new day that had dawned on the country, and was calling forth the highest aims and energies of the men of the time? There had been one intense fascination in his life that had turned to the ashes of bitterness. And now, while he was affable and enjoyed the society of women, he considered himself proof against their blandishments. He had heard of Daffodil's interrupted marriage, and gave her a very sincere sympathy. But he had not been warmly in favor of her visit. Still, it seemed cruel and selfish not to agree to the longing of the invalid, who had an obstinate idea that his days were numbered. A pet and play-thing was perhaps what he needed, for sometimes the devotion exacted bored him and seemed a painful waste of time and energy. Then M. de Ronville saw the necessity of arranging his guardianship of Daffodil Carrick on a different basis, so that there might be no
  • 75. trouble at his death. Her father might not understand all the fine points, and need some legal aid. This had brought about the visit to Pittsburg, and he had joined his solicitation to that of the guardian, truly believing M. de Ronville's days were numbered, and he did fervently desire to give him whatever happiness and comfort was possible. But Daffodil was different from the vague idea he had formed of her. She was not a sentimental girl, even if she had been caught by a specious love, and though gay and eager, had a tender, truthful, and noble side to her nature. They were all of a higher class than he had thought possible, and Felix he considered quite an unusual boy. Mr. Carrick had made one brief explanation of the marriage, none of the others alluded to it. "But you know that the law holds her as an unmarried woman. There was nothing binding in the vows on her side, and pure fraud on his," said Bartram decisively. "Yes, we are aware of that, but young as she is, it has changed her in some respects. But she is dearer than ever to us. I deprecate this fashion of such youthful marriages, though mine has been very happy," returned the father. Dr. Langdale came in one morning with a face full of the highest satisfaction. Bartram had been lingering about, discussing the journey. Madame Clerval had offered one of her French maids, but she knew so little of American ways. "Daffodil," the doctor exclaimed, "will you take me for an escort? I find there is nothing very important for the next few weeks. I have but one more lecture in my course. And I do want to see mother. So, if you have no objection——" "Why, I should be delighted, though I begin to feel quite like a wise and travelled body. And think how women are coming from abroad and from Canada, and going West, and all over, and reach their
  • 76. destination safely. But I shall be very glad all the same, and your mother will be wild with joy." "I am afraid we do not think of the pleasure we can give our elders, who, in the nature of things, have less time for the enjoyment of their children. And I feel ashamed that I have allowed the time to slip by, content with a hurried letter. I mean to do better in the future." "And I applaud your decision," exclaimed M. de Ronville. "Oh, I think you young people really do not know how much happiness you can give us elders just by the sight of your happy faces, and a little cordial attention." Daffodil glanced at Dr. Langdale with a smile that seemed almost a caress, it was so approving, enchanting. Aldis Bartram caught it and turned away, saying— "I must leave you to perfect arrangements. I am late now, so I must wish you good-morning," bowing himself out of the room. He was very busy, and did not go home to dinner, as he had been doing of late. And it was not until he was walking home in the late afternoon that he allowed himself to think of Daffodil's departure. "She will marry Dr. Langdale and come back here to live, which will be a great pleasure to M. de Ronville," he said to himself, remembering it had his friend's approval. And why should it not have his? Yet he felt as if he did not cordially assent. And if she returned next winter—he lost a sudden interest in the plan. They would be lovers and there would be their joy and satisfaction flaunted in everybody's face. How could Daffodil keep so bright and cheerful? Had she any real depth? Did not every change, every new plan appeal to her just the same? But if he had seen her with her arms about Mrs. Jarvis' neck, and the tears in her eyes, he would not have made the comment to
  • 77. himself. And the tender, beseeching tone in which she was saying— "Oh, you will not let him miss me too much. And when it is pleasant, won't you walk about the garden with him and praise his roses and the flowers he cares for? And keep him thinking that he is better, and has years yet to live, and if Mr. Bartram will go on being devoted to him." "Mr. Bartram seems to have grown more tenderly thoughtful. Of course, he has a great deal on his mind, and now there are so many perplexing questions about the country, and when one is tired out with the day's work it is hard to rehearse it all over. Oh, my dear, I think you have worked a change in us all with your sweet, generous ways, and your lovely outflowing youth. I am afraid I was beginning to think too much of my own comfort." Dr. Langdale proved himself most solicitous. Bartram found the planning was taken quite out of his hands, and he chafed a little. Madame Clerval declared herself inconsolable, but she had the fine grace that speeds the parting guest when the going is inevitable. There was only one day more. M. de Ronville had his breakfast sent upstairs. Daffodil went to find some papers her guardian was going over, and turning, she met Aldis Bartram entering the library. "I was afraid you might forget them," she said, handing the packet to him. "Thank you." How often she had charged her mind with these little things. "I suppose," he began in a wandering sort of tone, as if his mind had strayed to something else, "that it will not really be out of order to congratulate you, since it will be a long while before I shall see you again." "Oh, about going home? But I shall often think of you all here, and wish the old fairy stories were true, where you could be transported elsewhere in a moment. I think I did truly believe in them once."
  • 78. How charming she was in that absolute simplicity, the exquisite, innocent, glowing face too frank for concealment. He had no business to probe her secret, and yet he must know. "Oh, I meant, you will not come back to us the same. You will have learned the lesson of love, and I hope—you will be very happy." "I don't understand"—a puzzled line settling in her fair brow. "Oh!" suddenly relieved, and then half smiling, "did you think," and then her face crimsoned to its utmost capacity, "that I, that Dr. Langdale —it is a mistake. We were dear friends in childhood, we are warm friends now. For, you see, he has been like a little bit of Pittsburg to me, and sometimes, when I was longing for the dear ones at home, it was comforting to talk them over. And he has no thought of marrying in a long, long while. He means to do so much first." Was she a finished coquette by the grace of nature? Young men were not given to consideration of this or that when the bewildering passion seized them. But coquette or not, a sharp, overmastering knowledge seized him. Once she had advised him to marry and bring in the household a charming girl. She recognized that his duty would be to M. de Ronville while he lived. He knew that, too, if he would not prove himself an ingrate. And here was the charming girl. He looked at her so long and steadily that there came faint colors in her face, growing deeper, the lines about her mouth showed tremors, the bronze-fringed lids drooped over her eyes, and she turned away. But the delicious half-bashful movement set his pulses aflame. "Daffodil," and he caught her hand, "if there is no other among these young men, or even at home, may I not sue for a little favor? I know it surprises you; then perhaps I am too old to win a young girl's regard, love I mean——" "Oh, you must not," she interrupted. "For I think you hardly like me —you did not at first. And then, I—well—I do not mean to marry. You know there was the——"
  • 79. "Which simply has no weight in your life." "But you see, I thought I loved him. Oh, I did love him. And I was so happy. Why, I would have gone to the end of the world with him! Only when one deceives you, when one dares not tell the whole truth, and when one cannot, does not want to give up wealth and station, what was love is some way crushed out. But how could I tell if any new love was the right thing? I might be mistaken again. And there are fickle women in the world I have heard, who can love many times. I don't desire to be one of them. Maybe it is only friendship I am fitted for." She was trembling in every pulse, though she had made such a brave defence. And she seemed to him a hundred times sweeter than she ever had before. He had much ado not to clasp her to his heart. "My dear little Daffodil," he said with passionate tenderness, "though you have been wooed and said marriage vows, you know nothing about a true and fervent love. That was not much beyond a child's fancy, and you have overlived it, or you could not be so light- hearted. It is only a dream in your life. And I will wait until the woman's soul in you wakes. But I shall not let you go from my influence, I shall keep watch and ward, and try to win you." "No, no, I am not worth all that trouble. No, do not try," she pleaded. "I shall take your earlier advice. You said I must marry some charming girl and bring her here. No other girl or woman could satisfy M. de Ronville as well." "Did I advise you to do that?" and she blushed daintily. "Well," and there was a glint of mischief in her eyes, soft as they were, "once I was offered to you, and you declined." "Offered to me?" in surprise. "When I was here before. It was in this very library. I was outside, and when I knew who was meant I ran away."
  • 80. "Oh, you were such a child then! And I was doing something that I have always despised myself for. I knew a beautiful and fascinating woman, who led me to believe she cared a great deal for me. And then she laughed at my folly. I deserved it for my blindness. So you see, I too had a rude awakening, and found that it was not love, but a mere sham. I believe for a month or so I have been trying not to love you, shutting my eyes to a longing that stirred all my nature. And now that I have admitted it, it has taken a giant's growth in a few hours. I will wait until you can give me the true, sincere regard of your soul. But I could not let you go until I had settled whether I had any ground for hope. Shall we be friends, dear and fond friends, until that time? But I want to be loved sincerely, deeply." She stood like a lovely culprit before him, and then he did enfold her in his arms, and pressed his lips against her blushing cheek. "Oh, I cannot tell—yes, I like you—and you will be good to him while I am gone. But it is new and strange to me, and I cannot promise." "But there is no one else—tell me that." "There is no one else. But whether—I can love again;" and there was a great tremble in her voice, "whether it would be right." "Oh, little innocent, you will find the right and the truth some day, I feel assured of that. I can trust you to tell me by word or sign when that day comes, for I know you will be honest. And now I must go, but I take with me a joy that will make glad the days and weeks of separation. Oh, my little darling!" He went out of the house with a proud tread. He would never pause until he had won her. His soul was startled and roused by the sudden revelation of himself. He had supposed he should marry sometime, after his duty was done here, for he could not imagine a woman broad enough to share it with him. And here an angel had touched him with her fine beneficence, and shown him the duty in a stronger, truer light.
  • 81. There was not much time for the ardent side of love, though Aldis Bartram had to fight with himself for a show of mere friendliness. She was to go at ten the next morning, and friends came to escort her. "And I shall stay and help our good friend to bear the trial of parting," declared Madame Clerval. "We will talk over your virtues and your shortcomings, the lovers you might have had if you had been an astute young woman, and try to shed some sunshine on the doleful days until next winter." There was the maid with some budgets, there was Dr. Langdale, proud and serene enough for a lover, and it did rouse a spasm of jealousy in the soul of Aldis Bartram. But he knew she was truth itself, and he could depend upon her.
  • 82. CHAPTER XVIII A REVELATION It was a lovely journey if the term could be applied to the old- fashioned stagecoach. But the season of the year, the bloom and beauty everywhere, and the pleasant companionship lightened the few discomforts for Daffodil. There are natures that refrain from spoiling anticipations by cares or perplexities left behind, and hers was one. Indeed, hers was not complex, and people, women especially, had not learned to crowd so many interests, and fears, and hopes together. She would see those she loved the best, yes, she did love them the best of all now. How glad they were to get her back! Yes, there were changes and changes. New business plans and firms, old ones enlarged, discoveries of coal and iron all about, materials for glass-making, a paper mill under consideration. But the war was not yet over. The advisers of the King had begun to adopt a tone of insolence toward the young Republic; indeed, in spite of peace being signed, there was still an endeavor to stir up the Indians on the outskirts of many of the towns. The Indian villages along the Maumee received supplies of arms and ammunition, and were fortifying their own forts. The alarm spread down the Ohio. The British had not yet given up all the forts they had held in the preceding war, in spite of the agreements.
  • 83. Tired of inaction, Lieutenant Langdale had, with several others, offered his services to General Anthony Wayne, as there was great need of trained officers. So Mrs. Langdale was doubly delighted with this visit of her son, of whom she was quite as proud as of her soldier. "And I hope you have made good your chance with Daffodil Carrick," she said to him a few days after his return. "She'll be quite worth the winning, even if the father's money should all go to the son, who is a very promising lad, I hear. But they count on having a big place over the river, and that is all her share. One of you boys ought to win her. I thought it would be Ned. And you have had a chance all winter." Archibald smiled, but there was no disappointment in it. "She was a great favorite all through the winter, and she can marry any time she likes. But I have too much to do to take upon myself family cares, and I think she isn't the sort of girl to be in a hurry. We are just fine, sincere friends." "But I want you to marry. And I've counted on grandchildren. I wish I had you both settled just around me. I shall be a lonesome old woman." "Then when I am rich enough to set up a house, you shall come and live with me." "Do you think Dilly's going to let that miserable mess of a marriage spoil all her life?" "Oh, she is very happy, mother; girls don't marry as young as they did, and it is a good thing, too. They have some years of bright, gay girlhood, and won't get worn out so soon. Daffodil is a charming girl." "But she's getting quite along, and it isn't like being a widow either," said the mother, who thought every girl ought to marry.
  • 84. Daffodil watched mother and grandmere with longing eyes. Yes, grandmere was getting old. Her mother was losing the pretty girlishness, but she was very happy in her husband, and her son, who was tall and very good-looking, quite toned down in manner. The house had no more changes. Here was her pretty room. Oh, yes, there was a new bright rag carpet on the floor. She went around with a tender touch on everything, patting the white pillow-slips, straightening a picture or two, and wondering in a curious fashion if sometime her brother's wife would be here and a group of merry children—she hoped there would be a houseful of them. And gran would be a great-grandfather, and sit in the big chair at the corner of the fireplace, that he had covered over with buckskin of his own tanning. Where she would be she did not plan. Only she would not mind being an old maid, she thought. Everybody in the little circle supposed she would marry Dr. Langdale, and were surprised when his mother sorrowfully admitted it was not to be. "There's them that goes through the woods, and picks up a crooked stick at the last;" and Norah shook her head resentfully. "My stick won't be crooked, I promise you," laughed the girl. "You may have no stick at all and go limping afoot and alone," was the curt rejoinder. She was very happy, why she could hardly tell, for she felt she ought not to be. There came a letter with the stamp of the office on it and it had two enclosures. Her guardian's was most pleasant and fatherly. They missed her very much, but Mrs. Jarvis had taken on a new phase of kindliness so that he should not long too much for Daffodil, and Aldis was like a son. They went out driving together. And Aldis had grown so fond of the garden that he had not used to care much about. The weather was fine and he really was quite well for an old gentleman.
  • 85. Welcome to our website – the perfect destination for book lovers and knowledge seekers. We believe that every book holds a new world, offering opportunities for learning, discovery, and personal growth. That’s why we are dedicated to bringing you a diverse collection of books, ranging from classic literature and specialized publications to self-development guides and children's books. More than just a book-buying platform, we strive to be a bridge connecting you with timeless cultural and intellectual values. With an elegant, user-friendly interface and a smart search system, you can quickly find the books that best suit your interests. Additionally, our special promotions and home delivery services help you save time and fully enjoy the joy of reading. Join us on a journey of knowledge exploration, passion nurturing, and personal growth every day! ebookbell.com