Programming in Java Sachin Malhotra pdf download
Programming in Java Sachin Malhotra pdf download
https://textbookfull.com/product/programming-in-java-sachin-
malhotra/
https://textbookfull.com/product/java-programming-joyce-farrell/
https://textbookfull.com/product/java-programming-joyce-
farrell-2/
https://textbookfull.com/product/computer-graphics-programming-
in-opengl-with-java-gordon/
https://textbookfull.com/product/murach-s-java-programming-joel-
murach/
Learning Java An Introduction to Real World Programming
with Java Marc Loy
https://textbookfull.com/product/learning-java-an-introduction-
to-real-world-programming-with-java-marc-loy/
https://textbookfull.com/product/learning-java-beginning-
programming-with-java-for-dummies-first-edition-john-bach/
https://textbookfull.com/product/java-network-programming-fourth-
edition-harold-elliotte/
https://textbookfull.com/product/java-performance-in-depth-
advice-for-tuning-and-programming-java-8-11-and-beyond-2nd-
edition-scott-oaks/
https://textbookfull.com/product/introduction-to-programming-in-
java-an-interdisciplinary-approach-2nd-edition-robert-sedgewick/
Programming in
Java
Second Edition
SACHIN MALHOTRA
Associate Professor
IMS, Ghaziabad
SAURABH CHOUDHARY
Formerly, Head
IT Department
IMS, Ghaziabad
1
3
Oxford University Press is a department of the University of Oxford.
It furthers the University’s objective of excellence in research, scholarship,
and education by publishing worldwide. Oxford is a registered trade mark of
Oxford University Press in the UK and in certain other countries.
Published in India by
Oxford University Press
YMCA Library Building, 1 Jai Singh Road, New Delhi 110001, India
ISBN-13: 978-0-19-809485-2
ISBN-10: 0-19-809485-X
Sachin Malhotra is currently Associate Professor in the IT department of IMS Ghaziabad. He has more
than a decade long experience in mentoring students on developing Java applications as well as training
practising professionals in the field of Java. He has also designed and conducted various corporate
trainings in Java and networking.
Saurabh Choudhary is currently a practising IT consultant and corporate trainer. He has more than 12
years of experience in industry, academia, and consultancy. He has worked on positions of eminence
at IMS Ghaziabad as Head of IT department and Dean Academics (University Campus). His areas of
expertise include Java, Database Management System, and Information Systems.
Testimonials
From pervasive computing to communications industry, medical science to aerospace, Java is
gaining a foothold in every domain. Programming in Java has been written to arouse the interest
even in a novice computer programmer to an expert, craving to sharpen his programming skills.
Pankaj Verma | Senior Software Engineer | OSI Inc.
It is definitely the best textbook on Java that I have run into. I highly recommend it.
Sachin Dhama | Team Lead | Accenture
Java is a very powerful language for developing enterprise applications. I am hopeful that this
book will provide a basic building platform for Java programmers to enhance their knowledge.
Awadhesh Kumar Katiyar | Technical Lead | HCL Technologies Ltd.
Java enables users to develop applications on the Internet for servers, desktops computers, and small
handheld devices. The future of computing is being influenced by the Internet, and Java promises to
play a big part in it. This book is perfect for those who are seeking a clear understanding of Java. It
should allow the readers to create codes that are a lot clearer and are far more effective than before.
Saurabh Moondhra | Sr. Technical Consultant | SGT Inc
This is the most interesting Java programming book for beginners; at the same time, it is equally
good for intermediate readers as well. This should be your first Java book if you are learning
from scratch.
Pankaj Jain | Senior Manager | Bank of America
When you go through this book, you will gain confidence after completing each chapter. The
authors have written it in such a simple way covering each and every aspect of Java that anyone
can learn how to develop effective codes.
Rajeev Varshney | Lead Consultant | HCL NZ Ltd.
Preface to the First Edition
Java was primarily designed as a platform-independent language for usage in small consumer
electronic devices. It was derived from C++ but with a lot of difference. Java’s platform
independence originally addressed the problem that applications for embedded devices must
run on a wide variety of hardware. But since the Internet was emerging at the same time, Java
soon got adopted as an Internet language because of its portable nature. Major Internet browsers
such as Netscape Navigator and Microsoft Internet Explorer became Java-compatible, as it
effectively addressed the concerns for security by providing a firewall between web applications
and the computer. Eventually it became a standard programming language and is now being
used for creating a variety of applications including standalone applications, web applications,
enterprise-wide applications, and mobile games.
It can therefore be inferred that since its inception, Java has emerged as the most important
programming language. As the domain of Java is quite vast and a bit more complex than other
programming languages such as C, C++, and Visual Basic, it is observed that students and novice
programmers strive hard to comprehend its core concepts. Hence, a need for a book in this area,
which is both concise and simple, is a necessity.
About the Book
The book encapsulates the concepts of the latest version of Java, i.e. Java 6, encompassing a
comprehensive coverage of curriculum and industry expectations. It is useful for the students of
undergraduate and postgraduate courses of computer science and engineering and information
technology disciplines as well as for the instructors at various levels.
The book provides a thorough understanding of the basic concepts of object-oriented
programming principles and gradually moves on to the advanced concepts in Java. It includes
numerous examples, line-by-line description of examples, figures, explanation of concepts, and
key notes. Review questions and programming exercises are included as chapter-end exercises
to assess the learning outcomes. Every topic in the book is supported by examples followed
by an output and explanation. It also offers an appendix on general interview questions which
provides students an insight into the current requirements of the industry and allows them to
prepare accordingly.
The main features of this book include the following:
an exhaustive coverage of Java features such as operators, classes, objects, inheritance,
logging API, console class, StringBuilder class, NetworkInterface class, and assertions
latest features combined with core concepts such as multithreading, applets, AWT, and
swings
an introduction to the advanced concepts in Java such as servlets, RMI, and JDBC
Preface to theLab
Appendix A: Lab Manual—Java First Edition XIxi
Exercises
ACKNOWLEDGEMENTS
Several people have been instrumental throughout this tiring yet wonderful journey. First of all,
we would like to express our sincere gratitude to our families without whose support, patience,
and cooperation, this would not have been possible and we would not have been what we are
today. We are very thankful to Dr R. K. Bharadwaj, Head of our institution, for his inspirational
thoughts which inculcated urgency for writing this book. We are also thankful to our colleagues
for their endless support and suggestions during the entire process of writing this book.
Sachin Malhotra
Saurabh Choudhary
Preface to the Second Edition
Java is an easy-to-learn, versatile, robust, portable, and secure language with rich user interfaces.
It has set up new benchmarks in the software development world ranging from desktop to web-
based enterprise applications to mobile and embedded applications. Since its inception in 1995,
it has come a long way by continuously evolving itself and in the process, changing the style of
programming the world over. Java is not only found in laptops or data centres, it is also widely
used in cell phones, SIM cards, smart cards, printers, routers and switches, set-top boxes, ATMs,
and navigation systems, to name a few. According to Oracle, a staggering 1.1 billion desktops
and 3 billion cell phones are based on Java.
This second edition of Programming in Java confirms to Java Standard Edition 7, the latest
release since Oracle took over Sun Microsystems. It is significant in the sense that the last update
was six years back and this major release comes bundled with plenty of enhancements which were
overdue. To list a few noticeable enhancements, Java 7 includes support for strings in switch and
try-with-resources statements, improved multi-catch, binary numeric literals, numeric literals
with underscores, new APIs in NIO such as path and files, automatic resource management, and
much more. All the new topics are appropriately explained with suitable examples.
New to the Second Edition
This revised edition has been updated thoroughly with greater topical coverage as well as more
programming examples in every chapter, in addition to the confirmation to Java 7. Practically
every chapter, with the exception of Chapter 11, has been revisited to refine the text as much as
possible. The most noticeable changes are as follows:
New practical programming examples to show how Java is used in practice.
Enhanced coverage of servlets and JDBC along with an introduction to JSP, Java beans,
Appendix B contains more interview questions to help students prepare for their interviews.
The second edition is supplemented with a rich online resource centre that contains chapter-
wise PPTs for teachers and additional practical programming examples for students.
Key Features
The most prominent feature of this book has been the line-by-line explanation section under
each program. They facilitate in-depth understanding of the whole program. We have retained
this feature in the second edition as it has been well appreciated by the users. Other noticeable
features include the following:
Preface to the Second Edition vii
forms the core of the java.util package. This concept along with its application has been covered
in detail.
Chapter 11 explains how network programming can be done in Java. In-depth coverage of
sockets is extended in this chapter. Client and server concept is illustrated by the programs
created. TCP and UDP clients and server and their interactions are demonstrated. The concept
of multithreading is merged with socket and illustrated to create server programs. Some main
classes such as URL, URL connection, and network interface (new feature) are also discussed.
Chapter 12 focuses on applets, its lifecycle, methods, etc. and how they are different from
applications. Besides providing an in-depth coverage of java.applet package, some of the
classes of java.awt package are also discussed as they are very useful in creating applets such
as Graphics class, Font class, Color class, and FontMetric class. All these classes are discussed
and supported by an example for each of them.
Chapter 13 talks about event handling in Java. Basically for creating effective GUI applications,
we need to handle events and this forms the basis of this chapter. The event handling model is
not only discussed but applied throughout the chapter. All the approaches to event handling have
been discussed such as Listener interfaces, Adapter classes, inner classes, and anonymous inner
classes.
Chapter 14 focuses on GUI creation through java.awt package. It has an in-depth coverage
of containers and components. Containers like Frame, Window, etc. and components like Label,
Button, TextField, Choice, Checkbox, List, etc. are discussed in detail. How the components can
be arranged in a container is also discussed, e.g. BorderLayout, GridBagLayout, and GridLayout.
Chapter 15 shows how to create more advanced and lightweight GUI applications in Java.
More advanced layouts like SpringLayout have been discussed. Lightweight components like
JButton, JLabel, JCheckBox, JToggleButton, JList, JScrollPane, JTabbedPane, etc. have been
discussed. How to create Dialogs is also discussed. The pluggable look and feel of Java is
explained in detail.
Chapter 16 focuses on advanced Java concepts such as servlets, JDBC, and RMI. An
introduction to the advanced technologies has been discussed. This chapter is equipped with
numerous figures showing how to install the necessary softwares required for executing an
advanced Java program. The chapter also provides a step-by-step and simplified approach on
how to learn advanced concepts.
Appendix A on practical lab problems will facilitate better understanding of the concepts
explained in the book. Appendix B includes a list of interview questions along with their answers
that provides an overview of the industry scenario and their requirements.
ACKNOWLEDGEMENTS
Several people have been instrumental throughout this tiring yet wonderful journey. First of all, we
would like to express our sincere gratitude to our families without whose support, patience, and
cooperation, this would not have been possible and we would not have been what we are today.
We are also thankful to our colleagues and friends for their endless support and suggestions
during the entire process of writing this book. Lastly, we would also like to thank all our readers
/students who have supported us, encouraged us, and provided feedback to us regularly which
has helped us in shaping this edition.
Sachin Malhotra
Saurabh Choudhary
Brief Contents
Preface to the Second Edition vi
Preface to the First Edition x
Detailed Contents xiii
1. Introduction to OOP 1
2. Getting Started With Java 12
3. Java Programming Constructs 42
4. Classes and Objects 74
5. Inheritance 132
6. Interfaces, Packages, and Enumeration 156
7. Exception, Assertions, and Logging 199
8. Multithreading in Java 224
9. Input/Output, Serialization and Cloning 256
10. Generics, java.util and other API 296
11. Network Programming 336
12. Applets 354
13. Event Handling in Java 394
14. Abstract Window Toolkit 429
15. Swing 495
16. Introduction to Advanced Java 553
Appendix A: Lab Manual 628
Appendix B: Interview Questions 650
Index 657
Detailed Contents
Preface to the Second Edition vi
Preface to the First Edition x
comprehend the problems in procedural programming and how OOP overcomes them
1.1 INTRODUCTION
Object-oriented programming (OOP) is one of the most interesting and useful innovations in
software development. OOP has strong historical roots in programming paradigms and practices.
It addresses the problems commonly known as the software crisis. Software have become
inherently complex which has led to many problems within the development of large software
projects. Many software have failed in the past. The term ‘software crisis’ describes software
failure in terms of
Exceeding software budget
Software not meeting clients’ requirements
Bugs in the software
OOP is a programming paradigm which deals with the concepts of object to build programs
and software applications. It is modeled around the real world. The world we live in is full of
objects. Every object has a well-defined identity, attributes, and behavior. Objects exhibit the
same behavior in programming. The features of object-oriented programming also map closely
to the real-world features like inheritance, abstraction, encapsulation, and polymorphism. We
will discuss them later in the chapter.
2 Programming in Java
Note If we try to represent the CPU of a computer in OOP terminology, then CPU is the object.
The CPU is responsible for fetching the instructions and executing them. So fetching and
executing are two possible functions (methods or behavior) of CPU. The place (attributes)
where CPU stores the retrieved instructions, values and result of the execution (registers) will
then be the attributes of the CPU.
1.3.3 Abstraction
Can you classify the following items?
Elephant CD player
Television Chair
Table Tiger
How many classes do you identify here? The obvious answer anybody would give is three, i.e.,
Animal, Furniture, and Electronic items. But how do you come to this conclusion? Well, we
grouped similar items like Elephant and Tiger and focused on the generic characteristics rather
than specific characteristics. This is called abstraction. Everything in this world can be classified
as living or non-living and that would be the highest level of abstraction.
Another well-known analogy for abstraction is a car. We drive cars without knowing the
internal details about how the engine works and how the car stops on applying brakes. We are
happy with the abstraction provided to us, e.g., brakes, steering, etc. and we interact with them.
In real life, human beings manage complexity by abstracting details away. In programming,
we manage complexity by concentrating only on the essential characteristics and suppressing
implementation details.
4 Programming in Java
1.3.4 Inheritance
Inheritance is the way to adopt the characteristics of one class into another class. Here we have
two types of classes: base class and subclass. There exists a parent–child relationship among
the classes. When a class inherits another class, it has all the properties of the base class and it
adds some new properties of its own. We can categorize vehicles into car, bus, scooter, ships,
planes, etc. The class of animals can be divided into mammals, amphibians, birds, and so on.
The principle of dividing a class into subclass is that each subclass shares common
characteristics with the class from where they are inherited or derived. Cars, scooters, planes,
and ships all have an engine and a speedometer. These are the characteristics of vehicles. Each
subclass has its own characteristic feature, e.g., motorcycles have disk braking system, while
planes have hydraulic braking system. A car can run only on the surface, while a plane can fly
in air and a ship sails over water (see Fig. 1.1).
Vehicle
1.3.6 Polymorphism
Polymorphism simply means many forms. It can be defined as the same thing being used in
different forms. For example, there are certain bacteria that exhibit in more than one morphological
form. In programming, polymorphism is of two types: compile-time and runtime polymorphism.
Runtime polymorphism, also known as dynamic binding or late binding, is used to determine
which method to invoke at runtime. The binding of method call to its method is done at runtime
and hence the term late binding is used. In case of compile-time polymorphism, the compiler
determines which method (from all the overloaded methods) will be executed. The binding of
method call to the method is done at compile time. So the decision is made early and hence
the term early binding. Compile-time polymorphism in Java is implemented by overloading
and runtime polymorphism by overriding. In overloading, a method has the same name with
different signatures. (A signature is the list of formal argument that is passed to the method.)
In overriding, a method is defined in subclass with the same name and same signature as that
of parent class. This distinction between compile-time and runtime polymorphism is of method
invocation. Compile-time polymorphism is also implemented by operator overloading which
is a feature present in C++ but not in Java. Operator overloading allows the user to define new
meanings for that operator so that it can be used in different ways. The operator (+) in Java is
however an exception as it can be used for addition of two integers as well as concatenation of
two strings or an integer with a string. This operator is overloaded by the language itself and
the Java programmer cannot overload any operator.
Employee Class
name
address
designation Attributes
salary
addEmployee
deleteEmployee Behavior
searchEmployee
:Employee Object
name=peter
address=NY
designation=manager Attributes
salary=10000
addEmployee
deleteEmployee
searchEmployee
An instance of a class can be related to any number of instances of other class known as
multiplicity of the relation. One-to-one, one-to-many, and many-to-many are different types
of multiplicities that exist among objects. The multiplicities along with their examples and
respective notations are shown below. Figure 1.5(a) illustrates the generic notation for representing
multiplicity in object-oriented analysis and design. One-to-one mapping is shown as a straight
line between the two classes. Figure 1.5(b) shows the UML notation for demonstrating the one-
to-one mapping. The 1..1 multiplicity depicted on the straight line (both ends) indicates a single
instance of a class is associated with single instance of other class. Figure 1.5 shows that each
country has a president and a president is associated with a country.
(a) (b)
A country has many states and many states belong to a country. So there exists a one-to-many
relationship between the two. This relationship is shown in Fig. 1.6. Part (a) of this figure shows
the generic notation where a solid dot is indicated on the many side and both classes are joined
by a straight line. Figure 1.6(b) shows the UML notation where 1..* indicates the one to many
relationship between country and states. On the country end, a 1..1 multiplicity is placed to
indicate one country and on states end, a 1..* is placed to indicate many states.
(a) (b)
Let us take another example to explain many-to-many relationship. A teacher teaches many
students and a student can be taught by many teachers. There exists a many-to-many relationship
between them. Many-to-many relationship (Generic notation in OOAD) are represented by
placing solid dots on both ends joined by a straight line as shown in Fig. 1.7(a). The respective
notation in UML is shown in Fig. 1.7(b) where 1..* on both ends is used to signify many-to-
many relationship.
(a) (b)
Shape
Triangle Square
Shape
area( )
Another kind of relationship that exists among objects is the part-of-relationship. When a
particular object is a part of another object then we say that it is aggregation. For example, car is
Introduction to OOP 9
an aggregation of many objects: engine, door, etc. and engine in turn is an aggregation of many
objects, e.g., cylinder, piston, valves, etc. as shown in Fig. 1.10(a). A special kind of aggregation
is composition where one object owns other objects. If the owner object does not exist, the
owned objects also ceases to exist. For example, the human body is a very good example of
composition. It is a composition of different organs. The hands, feet, and internal organs such
as the lung and intestine are also parts of the body owned by the body.
Car
Human body
Engine Door
(a) (b)
a Date object would be created and used. At a later point of time, if a change is required, for
example, the year of Date class needs to be changed to four digits, then this change would be
incorporated in the class only and this change would automatically be reflected in all the objects
of the Date class whenever they are created and used. So, the change would have to be done at
one place only, i.e., the class and wherever the objects of the class are being used, the changes
would be reflected automatically. There is no need to analyze the whole code and change it.
In OOP, we access data with the help of objects, so it is very easy to overcome a problem
without modifying the whole system. Likewise, OOP is used in various fields, such as
Real-time systems Neural networks
Expert systems
SUMMARY
Object-oriented languages have become an ubiquitous large projects, a technique known as OOAD is used.
standard for programming. They have been derived Object-oriented analysis and design deals with how a
from the real world. OOP revolves around objects and system is modeled. OOA deals with what the system
classes. A class is defined as a group of objects with should do and OOD deals with how the system
similar attributes and behavior. OOP is a programming achieves what has been specified by OOA.
paradigm which deals with the concepts of objects to OOAD is realized with the help of a language known
develop software applications. Certain principles have as UML. UML stands for unified modeling language;
been laid down by OOP which are followed by every it is a standard language used for visualizing the
OOP language. These principles are: inheritance, software. An abstract model is created for the entire
abstraction, encapsulation, and polymorphism. software using graphical notations provided by UML.
We have presented a detailed comparison of
procedural and object-oriented languages. For building
EXERCISES
Objective Questions
1. In an object model, which one of the following is (c) Polymorphism (d) None of the above
true? 4. Which one of the following terms must relate to
(a) Abstraction, encapsulation, and multitasking polymorphism?
are the major principles (a) Static allocation (b) Static typing
(b) Hierarchy, concurrency, and typing are the
(c) Dynamic binding (d) Dynamic allocation
major principles
5. Providing access to an object only through its
(c) Abstraction, encapsulation, and polymor-
phism are the major principles member functions, while keeping the details
(d) Typing is the major principle private is called
(a) Information hiding (b) Encapsulation
2. Which one of the following is not an object-
(c) Modularity (d) Inheritance
oriented language?
(a) Simula (b) Java 6. The concept of derived classes is involved in
(c) C++ (d) C (a) Inheritance
3. The ability to hide many different implementations (b) Encapsulation
behind an interface is. (c) Data hiding
(a) Abstraction (b) Inheritance (d) Abstract data types
Introduction to OOP 11
Review Questions
1. Explain the importance of object-oriented pro- 4. Write short notes on: (a) inheritance, (b) poly-
gramming languages. morphism, (c) abstraction, (d) encapsulation.
2. Explain the difference between class and object. 5. Differentiate between runtime and compite-time
3. Differentiate between procedural languages and polymorphism.
OOP languages.
Programming Exercises
1. Identify the relevant classes along with their A hospital wants to keep track of scheduled
attributes for the following: A departmental store appointments of a patient with his doctor. When
needs to maintain an inventory of cosmetic items a patient is given an appointment, he should be
which might be found there. You should include given a confirmation that states the time and date
female as well as male cosmetic items. Keep of appointment along with the doctor’s name.
information on all items such as item name, Meanwhile the doctor should also be informed
category, manufacturer, cost, date purchased, about the patient details. Each doctor has one
and serial number. weekday as off-day and no patients should be
2. Identify the relevant classes along with their assigned to a doctor on that day.
attributes from the following problem specification:
2.1 INTRODUCTION
Java is a popular and powerful language. Although it is a very simple language, there are a
number of subtleties that can trip up less-experienced programmers. Java is an object-oriented
programming language with a built-in application programming interface (API) that can handle
graphical user interfaces (GUI) used to create applications or applets. Java provides a rich set
of APIs apart from being platform-independent.
Much of the syntax in Java is similar to C and C++. One of the major differences between
Java and other languages is that it does not have pointers. However, the biggest difference is that
you are forced to write object-oriented code in Java. Procedural code is embedded in objects.
In Java, we distinguish between applications and applets, applications being programs that
perform functions similar to those written in other programming languages and applets are
programs that are meant to be embedded in a web page and downloaded over the Internet.
When a program is compiled, a byte code is generated which can be executed on any platform,
provided the runtime environment exists on the destination platform.
This chapter guides the readers to a step-by-step introduction to Java programming. An
important thrust of this chapter is to cover the features of Java from an object-oriented perspective.
It also gives an insight about the installation of Java runtime environment and the various
integrated development environments (IDEs) of Java.
This chapter also focusses on the different versions of Java (including the latest Java 7) and
the Core API’s (Java 7 is also known as Java 1.7).
Random documents with unrelated
content Scribd suggests to you:
every sense of the word this Miss Parker was! What if she, Erskine's
mother, had been gifted with foresight, in those early years, had
been able to conceive of the possibilities hidden in that uncouth, silly
country girl, and had encouraged in Erskine the interest which she
then awakened? Or, failing in that, what if she had simply kept her
hand off and let things take their course? Would this woman with
her beautiful face and gracious ways and cultivated mind and heart
have become Erskine's wife, and her daughter? How extraordinary
that it should have been Mamie Parker who had touched her life
again, when she had labored so hard to be free from her, and had
succeeded! And it was Mamie Parker who had come to the rescue of
a desperately friendless girl who ought at this moment to be
sheltered in their own home! And then she was back in the meshes
of it all again!
She arose at length and began to move softly about her room
through the darkness. She must stay in the darkness, otherwise
Erskine might discover a light and insist upon being admitted. Very
softly she drew back her curtains and looked out upon the moonless
night. There were countless stars, but they gleamed from far away
and looked even more indifferent than usual to what was going on
below them. Softly she drew a chair beside the open casement and
sat down to try the effect of the cool night air upon her throbbing
head. If she could only get quiet enough to think! But those two
conflicting thoughts were still pounding away in her brain: "Erskine
must be told." "Erskine must not be told!"
There were no tears shed during those hours. The victim had
gone beyond tears. Her throat felt dry and parched and her eyes
burned, as one in a fever. She was beginning to realize that this
might be a conflict between right and wrong, and that her own
personality was engaged in it. The clock struck two, struck three,
and still that mother sat gazing out on the singularly quiet night.
Twice during that time she heard Erskine come with soft footsteps,
evidently to listen at her door.
She clutched at the arms of her chair, to keep her, and held her
breath that it make no sound.
Erskine went on tiptoe back to his room, and his mother, who had
almost spent her physical strength, sank limply back into her chair.
But before the clock struck again she had got to her knees. All the
while she had been conscious of a strange reluctance about going to
God with this trouble. Accustomed as she was, and had been ever
since she became a praying woman, to taking all things, small as
well as great, to Him, it had seemed strange even to herself that she
held back.
Not that she had said that she would not pray, she had simply
shrunken back with a half-frightened "Not yet, I am not ready yet;
let me think." But she reached the moment when she understood
that she must have help and must have it at once, and that only God
could give it.
"I am thankful to see you here," he said. "I was quite worried
about you last night. It is so unusual not to meet you at dinner and
have a little chat with you. You did not even give a fellow a chance
to say good-night! I was sure that something was wrong." His wife
laughed.
"Erskine cannot get away from the idea that he is his mother's
nursemaid," she said lightly. "And he is a real 'Miss Nancy' for
worrying. Such a night as he gave me, merely because you did not
choose to come down to dinner! He must have trotted out to your
door to listen twenty times, at least."
"What tired you so, mamma? Or rather, who did? Irene said you
had company all the afternoon."
"I think you will remember her; at least you will, her brother. It
was Miss Parker."
"'Miss Parker?' Not Mamie? How interesting! Why didn't you keep
her to dinner? I should like to have met her. Is she 'Miss Parker' still,
after all these years? That is rather surprising, isn't it? She must be
thirty or more. And what about her brother? I haven't heard
anything of him to speak of, since I left college."
"Who are these interesting people who seem to have just sprung
into existence again?" Irene asked. "I have never heard of Mamie
Parker, have I? Is she an old sweetheart of yours?"
"Is it possible!" said Erskine. "I think he is the last one I should
have chosen for such a future; from our class, I mean. Though he
was a fine fellow with a big unselfish heart. Didn't I always insist
upon that, mamma, in the days when you did not like him very well?
Weren't there such days? I have almost forgotten."
"She went back to school, Erskine, the winter after she visited her
brother, and prepared for college. She is a Smith graduate, think of
it! As for culture, I don't think I ever met a more perfect-appearing
lady than she has become."
"Dear me!" said Irene with a but slightly suppressed yawn, "what
a paragon she must be; I'm glad I didn't meet her. I detest
paragons. Now, if you, sir, can stop talking about her long enough to
consider it, have the goodness to tell me at what time I may expect
you in town this afternoon? We are to be at the Durands' at five,
remember. Don't you dare to tell me you must be excused, for I
have simply set my heart on having you with me."
But Erskine could not so readily be made to forget his anxieties.
He put off a direct answer to his wife, and followed his mother to
her room to press his inquiries tenderly.
"Are you sure that you are all right this morning, and that it was
only weariness which kept you so close a prisoner last night? There
is something about you that I don't quite like; there are heavy rings
under your eyes, and you are paler than usual. Did you sleep well?"
She knew that the truth was deceiving him, but it satisfied him.
He believed that Mamie Parker's troubles, whatever they were, had
been brought for his mother to share. His face cleared a little, but he
felt it his duty to administer a loving admonition.
She was able to smile as she assured him that she would. Despite
her night of vigil she felt strong. Her part had been revealed to her.
She was to keep Irene's secret, to suffer and to act in her stead; and
to shield her son's name and home as much as lay in her power. A
miserable travesty of a home it looked to her; still, it was all he had,
and for a time at least it could be kept sacred in Erskine's eyes. She
had no faith in a perpetual concealment; such skeletons, she
believed, were always unearthed sooner or later—often in
unexpected and mysterious ways. How remarkable, for instance, it
was that, of all the young women in the world who might have
discovered and befriended the deserted child it should have been
their old acquaintance Mamie Parker! Still, this morning, she could
thank God that she need not be the one to unearth this secret.
It is true that, even at this late day, her face flushed with pain
and shame over the thought of the manner in which she had done
this, at first; still, she had done it. And later, had she not herself
taken the initiative and opened the way for her husband to do his
belated duty? Who could know better than she the cost of such
effort? But there was one infinite difference between past
experiences and present problems. Both her father and her husband,
when the crucial test came, had a foundation of moral strength to
build upon; while Irene—
Ruth Burnham knew that she had tried very hard to find some
lighting up of the story. She had thoroughly probed Mamie Parker to
discover whether or not through the years the mother had made
some sign which proved that she at least knew of the continued
existence of her daughter; but there had been absolutely no proof
that she had ever thought of her six months' old baby again! Ruth
had to turn quickly away from that subject as one that would not
bear dwelling on. The idea that a mother had actually and
deliberately abandoned her baby, roused such a sense of revolt in
this woman's heart that there were times when she told herself that
she could not breathe in the same house with such a creature.
Miss Parker herself had seemed able to appreciate this feeling. At
least she had given no hint that she expected or hoped anything
whatever from the mother, and frankly owned that she had avoided
meeting her on occasions when there would have been opportunity.
She had not felt, she said simply, that anything could be gained by
coming in contact with her. And all her plea had been that Erskine's
mother should in some way interest herself in the welfare of the
lonely girl.
She was very lonely, now, more so by far than she used to be,
Miss Parker had said in a voice that trembled. Then she had waited a
few minutes to regain self-control before she explained that her
mother had to a very great extent taken the place of mother to the
little one.
"She used to spend her vacations with us," she said, "and mother
fell into the habit of looking after her clothes and her comfort in
every way, just as though she were a daughter; and the child loved
mother with a devotion that is uncommon in one so young. Of
course she cannot but miss her sadly."
"Have you lately lost your mother?" Ruth had inquired, and her
tone had been so full of tender sympathy that Miss Parker had
explained in detail how it was that she had only her brother left.
That was why she was going out to him, so that they might be
together, at least for a time, since they were all that was left of
home.
Jim had not married; his sister sometimes feared that he never
would. Didn't Mrs. Burnham think that was a calamity for a man?
"I used to think so," Ruth had replied, as one who did not realize
that she was speaking aloud, and then she had started and flushed
over the thought of what she might thus be revealing; and the flush
had deepened as she remembered what this woman already knew of
her son's wife. But Miss Parker had not once glanced in her
direction, and made no sign that she had heard. She went on,
quietly, talking about her brother. Men, she thought, were different
in that respect from women. A woman need never marry in order to
be comfortable, or to be cared for; but there were ways in which the
average man was helpless and almost homeless without the one
woman to care for him, selected from all the world. This was so
different from the usual putting of the subject that Mrs. Burnham
had felt impelled to smile. Yet as she looked at the beautiful woman
opposite her she admitted that her brother's home would certainly
be brightened by her presence. Still, it was a long way to go to make
a home for a brother.
"Do you have any thought of remaining there," she had asked. "I
mean, of making it a permanent home?"
Miss Parker did not know. She had not allowed herself to look
ahead very far. There were so many changes in life that it did not
seem wise to try to plan. She should like to remain there, like it very
much, she believed; that is, if she could help in the work. She was
sure that she could help Jim; at least, she could take care of him,
and give him more time to do his work; and Jim was a success. Still,
there were times when she was sorry that she had planned in this
way, on Maybelle's account. Even now, if she could make a change,
could delay a little, without incommoding her brother, she would do
so; but Jim had made plans in view of her coming that would
seriously inconvenience him if she did not go.
Yes, there had been changes, sad changes since her plans were
made. Mr. Somerville, who was a frail man and hopelessly careless of
himself, had contracted a cold, a few months ago, that had settled
on his lungs; and it was now evident to all but that poor little girl
that she would, before long, be fatherless.
Oh, she would be cared for, no doubt, so far as her body was
concerned. She was at school, and it was a good school, as good,
perhaps, as any of them. At least she, and her mother, had been at
infinite pains to discover it; still, it was school, and not home, and
poor Maybelle had never been quite happy there. The teachers were
kind, but cold and unsympathetic. They did not understand the child,
and they almost openly disapproved of her father. He went every
day to see her, but the time was coming when he would no longer
be able to do so, and she dreaded to think what Maybelle would do
when this truth dawned upon her.
In these and many other ways had Miss Parker made it apparent
to Mrs. Burnham that her hope lay in winning the woman who had
been so much to her, to become this deserted and lonely child's
friend and guardian.
If there were actual need on the part of the girl, such as could be
met by money, her way would have been clearer. But of this she had
thought at once, and Miss Parker had almost dignifiedly declined her
help.
That young woman had evidently taken it for granted that the
Burnham family were supplied with the main facts in this tragedy,
and had found it hard to rally from her astonishment at finding the
mother in ignorance. Ruth knew that she believed that Erskine was
not. She longed to tell her that this was false, yet held her pen. Did
not this infringe upon her solemn covenant with God to shield her
daughter-in-law as much as right would permit? Yet, was it right to
let her son's good name be smirched unnecessarily in the eyes of
this woman who had known him in his spotless youth?
"M. M. Parker."
CHAPTER XX
THEY HATED MYSTERY
"It does not seem quite right, mamma," he said, with a smile that
had almost wistfulness in it. "I am not used to seeing you off, you
know. It seems as though I should be going along to look after your
comfort."
"And you have really no idea when you are coming home?"
"I could not plan for it, dear. Your Aunt Flossy is a woman of
many schemes, you know, and it is long since I visited her; not since
you and I were there together, years ago."
His mother smiled on him tenderly, and a little sadly. "How did
you learn that, Erskine?"
"I don't think she knows anything about the journey, or the
stranger, my son."
"Then it is all Miss Parker's fault?" and he frowned. "She has not
grown like her brother; not as he used to be, at least. Why doesn't
she stay at home and attend to her own affairs, since they are of so
much importance? That sounds ugly, I know, but I don't like to lend
you, mommie, indeed I don't. You belong to me; and besides, there
seems to be an air of mystery about the whole matter, and I hate
mystery; at least between us."
It was at that moment that the call of "all aboard" sounded, and
Erskine gave his mother a hasty last kiss and made flying leaps
toward the platform.
It was a relief to have him go. His mother also hated mystery;
and despite her attempts at frankness, no one was more conscious
than she of the part that she had not told.
She had shown Erskine the telegram and made at the time the
very brief explanation which it had taken her hours to arrange.
"She is not related to Miss Parker," his mother had replied, and
was glad that at the moment she had been bending over a drawer,
so that her burning face was partially hidden. If Erskine only knew
whose responsibilities had been shifted! It was that thought which
burned her face.
"Well," Erskine had said, after waiting a moment for more words
that had not come, "I don't half like it, mamma. I am sure of that;
and if it were not for your making this long-promised visit to Aunt
Flossy, I should not consent to your going. As it is, rushing off at an
hour's notice, in response to an ordinary telegram, as though
somebody had a right to order you around, seems absurd. I shall
write to Aunt Flossy not to let your heart run away with your
judgment. I am really afraid you are being imposed upon, mamma.
Remember, we know nothing about these Parkers."
After his mother had watched, with the nervous tremors with
which one watches when all that one has is jumping from a moving
train—until Erskine was lifting his hat to her from safe ground, and
her train was gliding away from him, she drew a deep breath of
relief; not only from that immediate tension, but all the hours which
had preceded it. Every moment since the arrival of that telegram
had been a nervous strain to her, because of the things that she
must say, and the things that she must not say.
There was a side to this woman which Ruth in her secret soul
called coarse. So far as she knew, it was a phase of her character
that was never exhibited to Erskine.
With her fine regard for truth, and her contempt of anything like
subterfuge, Mrs. Burnham found it hard to satisfy the curious
questioner, and yet keep back that part of the truth which she must
not tell. She could not but be glad when the strain was over.
Not once had she mentioned the name of the girl. It had been a
continual terror to her lest she should be asked it; but though Irene
asked every possible question that might throw light on the mystery,
she had been mercifully preserved from thinking of names. Mrs.
Burnham had learned from Miss Parker that the first name, Maybelle,
would reveal nothing; it had been chosen by the father for his still
nameless child, months after the mother's desertion; and chosen for
no better reason than that Baby had come in the month of May, and
was a "little beauty." But the name of Somerville might at least have
startled Irene, had she heard it; and her mother-in-law determined
that she should not. Having resolved upon silence as the right
course, the more absolute it could be, the better for all concerned.
So it was not until the train was fairly under way, speeding
eastward at thirty miles an hour, that Ruth felt free to draw a long
breath and rest her overstrained nerves. Her mind wandered back
through the years, lured there by the thought of Flossy. It was years
since they two had been alone together, but just at this time Flossy's
husband had taken a hurried business trip abroad.
Dear Flossy! what a rarely wise little woman she had become!
astonishing them all, not by her sweetness,—they had always been
sure of that,—but by her strength and skill as a Christian worker. No
young woman left to herself in a dangerous world could have a
safer, more helpful friend than Flossy Shipley Roberts. Yet Ruth,
even as she thought this comforting thought, remembered that the
duty thrust upon her of guarding the hateful secrets of others must
prevent her from speaking plainly even to Flossy.
However, she found reticence with Flossy easier than it had been
with Irene. Joyfully glad to get possession of her old friend was Mrs.
Roberts, and athrob with eagerness to hear all that she had to tell
her, and sympathetic about the minutest details; yet in nothing did
she show her perfect breeding and rare tact more distinctly than in
the questions that she did not ask, concerning things that Ruth did
not choose to tell.
"And I know, dear Ruth, how certainly you will succeed," was Mrs.
Roberts's comment and her only one.
A little later she asked: "Where do you find your charge, Ruth? Is
she a young girl, did you say? Delightful! I hope you will let me
help? Oh, no, I must not go with you on your first visit, of course.
One new face at a time is enough for the poor child to meet."
Ruth blessed her in her heart for the delicate reserve which would
not let her question even about the woman who had gone to China.
After Irene's baldly put inference she shrank from trying to explain
Miss Parker's interest in the girl.
It was on the morning after her arrival in town that Mrs. Burnham
sat waiting in the reception room of a dignified, many-storied house,
which, she told herself, had everywhere about it the unmistakable
boarding-school air.
She had sent up her card, but was uncertain how much it would
tell, or whether she should be allowed to see the person on whom
she had called. As matters had turned out it seemed unfortunate
that she had so long delayed her visit to Mrs. Roberts. If she could
have been introduced here by Miss Parker in person, it might have
been better for all concerned. As it was, she felt strangely out of
place and embarrassed. She had not been able to decide just how
she would account for her extreme interest in this stranger. It was
especially embarrassing to remember that she must account for it
even to the girl herself. While she waited, she went back in memory
to that other waiting, in a boarding-house parlor, when she had
called to see Mamie Parker. What eventful years had intervened, and
what changes they had wrought! How mistaken she, Ruth Burnham,
had been about many things, notably her estimate of Mamie Parker.
Had she been able with prophetic insight to get a vision of the
woman Mamie was to be, would it have made a difference, a radical
difference with all their lives? Then she flushed to her temples as
she remembered that such thoughts were almost an insult to her
son.
Just then the door opened and there entered Madame Sternheim,
the head of the "Young Ladies' Fashionable School."
Yes, Miss Somerville was with them, of course. Her poor father
had left her in their charge, and a serious responsibility she found it.
Oh, yes, Miss Parker, before she left, had spoken of some one by the
name of—of Burnham—she referred to the card which she held in
her hand—who might write, or be heard from in some way. She
seemed not to be at all sure that any one would call.
Yes, certainly, the circumstances were peculiar and had been all
the time. The poor father—it was by no means a pleasant thing to
have to speak plainly of the dead, but it was sometimes necessary,
and perhaps Mrs.—yes, thank you, Mrs. Burnham, knew that he was
not in every respect the fit guardian for a young woman?
Oh, yes, Miss Parker had been most kind, most attentive; Miss
Somerville owed her a deep debt of gratitude, certainly.
Ruth was angry with herself that she must blush and almost
stammer over so simple a question.
No, that was what Madame Sternheim had been led to infer. The
relatives were all in England, were they not? It seemed strange that
the girl was not to go out to them; but then, her poor father—Had
Mrs. Burnham been personally acquainted with the father? Well, she
knew of him probably? which was perhaps quite enough. Miss
Parker's unaccountable interest in him was beyond understanding,
until one remembered that no one could tell on what the human
heart would anchor, especially a woman's heart. She had never
thought that Mr. Somerville was especially—but then he, poor man,
was gone; they need not speak of such things now. And Miss Parker,
too, was gone—to China! That was unaccountable. If love for the girl
had been what had prompted her attentions all these years, why,
the poor child was doubly in need of it now. She had been deeply
attached to her father despite the fact that—
A tall, pale girl with delicate features and great brown eyes and a
wealth of gold-brown hair.
"A study in black and white," was the phrase that floated through
Ruth's mind as she looked at her. The girl was in deep mourning
unrelieved even by a touch of white, and her face was intensely
pale. Yet there was something about her, a nameless something,
that claimed instant interest, and Mrs. Burnham, who, ever since she
had heard of the girl's existence, had been struggling with an
unreasonable desire to hate her, felt instantly drawn toward her. She
felt rather than realized that, whatever might have been Irene's
appearance in girlhood, the two had nothing in common now, for her
eyes.
"I have heard your name," the pale girl said, much as she might
have addressed a book agent, "but I did not know that you were
coming to New York."
"It is very kind," the girl said coldly, and stood irresolute
apparently as to what she should do or say next; while Ruth, sorry
for her and for herself and unreasonably annoyed with Madame
Sternheim, was at a loss how to proceed.
"Mrs. Burnham will naturally want to have a talk with you, and
learn what little you may be able to explain to her about this sad
matter, although I am too fully aware that it will be very
unsatisfactory." Then she turned to Ruth.
The girl turned at this, and with slow, languid steps preceded the
Madame to the door, which she held open for her to pass, and
bowed respectfully as she did so. Then, waiting until a turn in the
hall hid the lady from sight she carefully closed the door.
"Poor little girl!" Ruth said softly, and laid her hand tenderly on
the bowed head. There seemed no other word that could be spoken
until the storm of weeping had in a degree subsided.
"Oh, do forgive me!" the child said, after a minute, but without
raising her head. "I did not mean to cry, I meant to control myself; I
thought I could, through it all, but I am so wretched! and she—she
freezes me! she wants me to be resigned, and to remember how
much better off I am than some other girls who have no one to look
after them, and it doesn't help me one bit. I am so glad that you
have come! You are Aunt Mamie's friend, so you can't be like
Madame Sternheim; and you won't tell me that Aunt Mamie isn't
related to me in the most distant degree and in the nature of things
cannot be, will you? I can see that you are not like the Madame the
least bit in the world, and I am glad, glad! Oh! I am a very wicked
girl! I ought not to have said that; she is good, she is very good; and
she is patient with my faults and follies; and yet—there are times
when I almost hate her! Oh, dear! what will you think of me? I don't
act like this very often; I don't cry often—I don't cry at all! but now I
must, or I shall die!"
"Cry as much as you want to, dear child," Ruth said. "It is only
natural, and will do you good."
All the time her hand was moving over the tumbled masses of
hair, making quiet, soothing passes.
After a little the girl sat up and brushed away the tears. "I can't
think what made me," she said. "Only you reminded me of Aunt
Mamie, and then—it all came back. I don't know what I am to do; it
seems to me that I cannot live without her, but I have got to; and
without—everybody. It does seem sometimes as though there was
never another girl in the world so utterly alone; but Madame
Sternheim says there are, hundreds of them, even in this city! I am
so sorry for them all! I wish they could die and go to heaven. I wish
I could, with papa. But Madame Sternheim says—" she stopped
abruptly and struggled for self-control, and spoke almost fiercely.
"I won't tell you what she says about my father, nor think about
it. It isn't true, and if it were, she—"
"Poor little girl!" she said again, with infinite tenderness. "Will you
take me for a friend? I will do the best I can to be a true one."
"Oh, thank you," the child said impulsively. "I am so glad, so glad
for you! and only last night I thought I could never be glad about
anything again! Aunt Mamie had to go, of course, at the time
appointed. It isn't like other journeys, you know; they have to sail
when they are told; missionaries do, I mean. That is,—oh, you
understand. But Aunt Mamie felt very badly about leaving me; and
she said she thought you would love me; but of course I couldn't
see why you should. It isn't that I am not cared for, Mrs. Burnham. I
have been with Madame Sternheim for six years and I am sure that I
have every care and attention that a girl possibly could; she has
always made that plain to me; but—She did not like papa, Mrs.
Burnham. She never did; and she—almost spoke against him, even
to me! Could a girl ever care very much for one who talked and felt
as she did about the dearest, kindest, most loving papa that ever
lived? oh!"
She clenched her hands, and the tears threatened to choke her;
but she put them back with a strong will, and even faintly smiled.
"I shall not cry again," she said. "Madame thinks it is wicked. Mrs.
Burnham, I wish you could have known my papa. He was—I mean
he was not—oh, I don't know how to say it; and I am not sure that I
want to say it, ever. He was good to me always; a girl like me
couldn't have had a better father; and I don't know how to live in
this world without him. It kills me to have to stay all the time among
people who say always; 'Your poor father!' and shake their heads
and look as though they could say volumes of ugly things about him
if they chose. They shall not! I will not have people talking about my
father! the dearest, the best! a great deal better than the self-
righteous creatures made of icicles that they admire!"
Ruth was amazed at the suppressed fury of her tones, and at her
eyes which, but a moment before dim with weeping, now blazed
with indignation. Evidently the child had passed through a severe
mental strain.
As she spoke, she felt a sudden stricture at her heart over those
commonplace words. Was she not in these later days almost more at
home in Flossy's house than in her own?
"I think I must not go, Mrs. Burnham," she said. "I suppose I
ought not to wish, or even be willing to go; I am sure Madame
Sternheim will be shocked at the idea. I am in deep mourning, you
know, and my loss is so recent."
Ruth leaned forward impulsively and kissed her, while she spoke
with a smile:—
"Poor girl!" Mrs. Burnham said softly to herself after reading this
letter. "She has one of those hungry hearts that Maybelle talks
about; and she fancied that her brother could fill it, instead of being
quite satisfied with his generous corner of it! I wonder if it can be
possible that she cared for the child's father, as the Madame hints?
That would account for—but there is nothing to be accounted for;
one could not help loving Maybelle. I must tell Miss Parker that she
is always to have the first place in that 'curious' heart, while I am
enthroned as second. Dear simpleton!" Then, as the thought crossed
her mind, not for the first time, that the one who should hold that
first place might be named Erskine, the uneasy conviction shook her
that in such event certain ugly truths would have to be revealed.
But she put the thought from her as soon as possible. She could
not plan for the future, and for the present, Maybelle and Erskine
Roberts were simply comrades heartily enjoying each other's society,
as her own Erskine and Alice Warder had done, without apparently
other thoughts than those shared with them by Marian Roberts, who
was Erskine's twin.
"You may well call hers a 'loyal heart,' my friend," she wrote. "You
should hear the pathetic way in which the child talks about you by
the hour! Yesterday she said to me:—
"'Sometimes I used to wish that I could call Aunt Mamie, mother.
She is the only woman that I ever had such a thought about; I
suppose it was because she came close enough to give me an idea
of what a real mother would be. I mean to keep her always for my
heart-mother. There can be heart-mothers, you know, and in some
ways they are almost as dear as real ones. Oh, I wonder if you know
how a girl like me sometimes longs and longs for a real mother! I
think it is the only possession that I ever envied. Sometimes, Mrs.
Burnham, I have been fiercely jealous for hours together, so that I
almost hated the girls who chattered about their mothers. Wasn't
that dreadful! Oh, I cannot think what would have become of me
long before this, if I had not had Aunt Mamie.'"
Thus much Ruth Burnham wrote, and stayed her pen. Was it
necessary for her to tell all this? To lay bare even to this woman,
who knew so much, the depths of a suffering young heart, thereby
revealing the magnitude of the mother's sin against it? And that
mother was her daughter, her son's wife! She wanted to write it;
there were times when she wanted to shout it out to all the world,
just what manner of woman was being sheltered by her name and
home. She knew that she would never do it, but ought not Mamie
Parker who had mothered the child, to understand? She thought
long, she shed a few struggling tears that seemed to burn her face;
the hurt at her heart was too deep for tears, and then she hid her
face on the writing table and talked with God.
The end of it was that she tore the sheet across and threw the
fragments into her grate. And wrote again:—
"You may well call hers a 'loyal heart,' my friend; she loves with a
depth that seems to me unusual in one so young; and she has
enthroned you at her heart's very centre. I want to say, just here,
that I do not think she overestimates what you have done for her; I
believe you have saved her to herself."
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com