Java 9 with JShell Introducing the full range of Java 9 s new features via JShell 1st Edition Gastón C. Hillar pdf download
Java 9 with JShell Introducing the full range of Java 9 s new features via JShell 1st Edition Gastón C. Hillar pdf download
https://textbookfull.com/product/java-9-with-jshell-introducing-
the-full-range-of-java-9-s-new-features-via-jshell-1st-edition-
gaston-c-hillar/
https://textbookfull.com/product/beginning-java-9-fundamentals-
arrays-objects-modules-jshell-and-regular-expressions-sharan/
https://textbookfull.com/product/java-9-modularity-revealed-
project-jigsaw-and-scalable-java-applications-alexandru-jecan/
https://textbookfull.com/product/introducing-java-ee-7-a-look-at-
what-s-new-juneau-josh/
https://textbookfull.com/product/all-about-java-8-lambdas-
introducing-java-8-lambdas-1st-edition-konda/
Java 9 Recipes: A Problem-Solution Approach 3rd Edition
Josh Juneau
https://textbookfull.com/product/java-9-recipes-a-problem-
solution-approach-3rd-edition-josh-juneau/
https://textbookfull.com/product/pro-java-9-games-development-
leveraging-the-javafx-apis-1st-edition-wallace-jackson-auth/
https://textbookfull.com/product/java-9-revealed-for-early-
adoption-and-migration-1st-edition-kishori-sharan-auth/
https://textbookfull.com/product/java-9-modularity-patterns-and-
practices-for-developing-maintainable-applications-1st-edition-
sander-mak/
https://textbookfull.com/product/beginning-java-with-websphere-
expert-s-voice-in-java-janson-robert-w/
Java 9 with JShell
Gastón C. Hillar
BIRMINGHAM - MUMBAI
Java 9 with JShell
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78728-284-1
www.packtpub.com
Credits
Reviewer Proofreader
Daniel Mühlbachler Safis Editing
Copy Editor
Tom Jacob
About the Author
Gastón C. Hillar is Italian and has been working with computers since he was
8 years old. In the early 80s, he began programming with the legendary Texas
TI-99/4A and Commodore 64 home computers. Gastón has a bachelor's degree in
computer science (he graduated with honors). He also holds an MBA (he graduated
with an outstanding thesis). At present, Gastón is an independent IT consultant and
a freelance author who is always looking for new adventures around the world.
He was a senior contributing editor at Dr. Dobb's and has written more than a
hundred articles on software development topics. He has received the prestigious
Intel® Black Belt Software Developer award eight times. He has written many
articles about Java for Oracle Java Magazine. Gastón was also a former Microsoft
MVP in technical computing.
He lives with his wife, Vanesa, and his two sons, Kevin and Brandon.
Acknowledgement
At the time of writing this book, I was fortunate enough to work with an excellent
team at Packt Publishing, whose contributions vastly improved the presentation
of this book. Dominic Shakeshaft and Frank Pohlmann allowed me to provide
ideas to develop this book, and I jumped into the exciting project of teaching
object-oriented and functional programming with Java 9 using JShell as the main
tool. My conversations with Frank helped me realize my vision for this book
and create a robust table of contents. Radhika Atitkar provided many sensible
suggestions regarding the text, the format, and the flow. The reader will notice
her great work. I would like to thank my technical reviewers and proofreaders for
their thorough reviews and insightful comments. I was able to incorporate some of
the knowledge and wisdom they have gained in their many years in the software
development industry. This book was possible because they gave valuable feedback.
The process of writing a book requires a huge amount of lonely hours. I wouldn't
be able to write a book without dedicating some time to play soccer against my
sons, Kevin and Brandon, and my nephew, Nicolas. Of course, I never won a match.
However, I did score a few goals.
About the Reviewer
Daniel enjoys solving challenging problems and is always keen on working with
new technologies, especially those related to the fields of big data, functional
programming, optimization, and NoSQL databases.
More detailed information about his experience, as well as his contact details,
can be found at www.muehlbachler.org and www.linkedin.com/in/
danielmuehlbachler.
www.PacktPub.com
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all
Packt books and video courses, as well as industry-leading tools to help you plan
your personal development and advance your career.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our
editorial process. To help us improve, please leave us an honest review on this book's
Amazon page at https://www.amazon.com/dp/1787282848. If you'd like to join our
team of regular reviewers, you can e-mail us at [email protected].
We award our regular reviewers with free eBooks and videos in exchange for their
valuable feedback. Help us be relentless in improving our products!
I dedicate this book to my sons, Kevin and Brandon, and my wife, Vanesa
Table of Contents
Preface vii
Chapter 1: JShell – A Read-Evaluate-Print-Loop for Java 9 1
Getting ready for our journey toward OOP with Java 9 2
Installing the required software on Windows, macOS, or Linux 2
Understanding the benefits of working with a REPL 4
Checking default imports and using auto-complete features 7
Running Java 9 code in JShell 10
Evaluating expressions 12
Working with variables, methods, and sources 13
Editing the source code in our favorite external code editor 17
Loading source code 22
Test your knowledge 24
Summary 25
Chapter 2: Real-World Objects to UML Diagrams and Java 9
via JShell 27
Identifying objects from applications requirements 28
Capturing real-world objects 34
Generating classes to create objects 41
Recognizing variables and constants 44
Identifying actions to create methods 47
Organizing classes with UML diagrams 51
Using feedback from domain experts 53
Test your knowledge 59
Summary 60
[i]
Table of Contents
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Preface
Java is definitely one of the most popular programming languages of this century.
However, whenever we had to quickly explore new algorithms or new application
domains, Java didn't provide us with a simple way of executing code snippets and
print the results. As a result of this limitation, many developers started working
with other programming languages that offered a REPL (Read-Evaluate-Print-Loop)
utility, such as Scala and Python. However, many times, it was necessary to go back
to Java after the exploratory phase finished and the requirements and the algorithms
were clear.
Java 9 introduces JShell, a new utility that allows us to easily run Java 9 code
snippets and print the results. This utility is a REPL, and makes it easy for us to work
with Java as developers do with Scala and Python. JShell makes it easier to learn Java
9 and its most important features.
[ vii ]
Preface
This book will allow you to develop high-quality reusable object-oriented code in
Java 9 with JShell. You will learn the object-oriented programming principles and
how Java 9 implements them, combined with modern functional programming
techniques. You will learn how to capture objects from real-world elements and
create object-oriented code that represents them. You will understand Java's
approach towards object-oriented code. You will maximize code reuse and reduce
maintenance costs. Your code will be easy to understand and it will work with
representations of real-life elements.
In addition, you will learn how to organize code using the new modularity feature
introduced in Java 9, and you will be ready to create complex applications.
Chapter 2, Real-World Objects to UML Diagrams and Java 9 via JShell, teaches how to
recognize objects from real-life situations. We will understand that working with
objects makes it easier to write code that is easier to understand and reuse. We will
learn how to recognize real-world elements and translate them into the different
components of the object-oriented paradigm supported in Java. We will start
organizing classes with UML (Unified Modeling Language) diagrams.
Chapter 3, Classes and Instances, shows that classes represent blueprints or templates
to generate the objects, which are also known as instances. We will design a few
classes that represent blueprints of real-life objects. We will learn about an object's
life cycle. We will work with many examples to understand how initialization works.
We will declare our first class to generate a blueprint for objects. We will customize
its initialization and test its personalized behavior in action with live examples in the
JShell. We will understand how the garbage collection works.
Chapter 4, Encapsulation of Data, teaches you the different members of a class in Java
9 and how they are reflected in members of the instances generated from a class. We
will work with instance fields, class fields, setters, getters, instance methods, and
class methods. We will generate computed properties with setters and getters. We
will take advantage of access modifiers to hide data. We will use static fields to create
values shared by all the instances of a class.
[ viii ]
Preface
Chapter 5, Mutable and Immutable Classes, introduces the differences between mutating
and non-mutating objects. First, we will create a mutable class, and then we will
build an immutable version of this class. We will learn the advantages of non-
mutating objects when writing concurrent code.
Chapter 7, Members Inheritance and Polymorphism, teaches you how to control whether
subclasses can or cannot override members. We will take advantage of one of the
most exciting object-oriented features: polymorphism. We will take advantage
of JShell to easily understand typecasting. We will declare methods that perform
operations with instances of classes.
Chapter 10, Maximization of Code Reuse with Generics, introduces you to working
with parametric polymorphism. We will learn how to maximize code reuse by
writing code capable of working with objects of different types, that is, instances of
classes that implement specific interfaces or whose class hierarchy includes specific
superclasses. We will work with interfaces and generics. We will create a class that
works with a constrained generic type. We will use a generic class for multiple types,
thanks to generics.
[ ix ]
Preface
Chapter 13, Modularity in Java 9, puts together all the pieces of the object-oriented
puzzle. We will refactor existing code to take advantage of object-oriented
programming. We will understand the usage of modular source code in Java 9. We
will work with modules to create a new Java 9 solution, organize object-oriented
code with the new modularity in Java 9, and learn many techniques of debugging
object-oriented code.
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
[x]
Preface
Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
Code words in text are shown as follows: "JShell allows us to call the System.out.
printf method to easily format output we want to print."
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
double getGeneratedRectangleHeight() {
final Rectangle rectangle = new Rectangle(37, 87);
return rectangle.height;
}
New terms and important words are shown in bold. Words that you see on the
screen, in menus or dialog boxes for example, appear in the text like this: "Click on
Accept and then click on Exit."
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
[ xi ]
Preface
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
1. Log in or register to our website using your e-mail address and password.
2. Hover the mouse pointer on the SUPPORT tab at the top.
3. Click on Code Downloads & Errata.
4. Enter the name of the book in the Search box.
5. Select the book for which you're looking to download the code files.
6. Choose from the drop-down menu where you purchased this book from.
7. Click on Code Download.
You can also download the code files by clicking on the Code Files button on the
book's webpage at the Packt Publishing website. This page can be accessed by
entering the book's name in the Search box. Please note that you need to be logged in
to your Packt account.
Once the file is downloaded, please make sure that you unzip or extract the folder
using the latest version of:
The code bundle for the book is also hosted on GitHub at https://github.
com/PacktPublishing/Java-9-with-JShell. We also have other code bundles
from our rich catalog of books and videos available at https://github.com/
PacktPublishing/. Check them out!
[ xii ]
Preface
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
We appreciate your help in protecting our authors and our ability to bring you
valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at
[email protected], and we will do our best to address the problem.
[ xiii ]
JShell – A Read-Evaluate-
Print-Loop for Java 9
In this chapter, we will start our journey toward object-oriented programming with
Java 9. You will learn how to launch and work with a new utility introduced with
Java 9 that will allow us to easily run Java 9 code snippets and print their results:
JShell. This utility will make it easy for you to learn object-oriented programming.
We will do the following:
[1]
JShell – A Read-Evaluate-Print-Loop for Java 9
Most of the time, we won't use any IDE (Integrated Development Environment),
and we will take advantage of JShell and many other utilities included in the JDK.
However, you can use any IDE that provides a Java 9 REPL to work with all the
examples. You will understand the benefits of working with a REPL in the next
sections. You will definitely benefit from an IDE in the last chapter where you will
explore the new modularity features introduced with Java 9.
You don't need any previous experience with the Java programming
language to work with the examples in the book and learn how
to model and create object-oriented code with Java 9. If you have
some experience with C#, C++, Python, Swift, Objective-C, Ruby, or
JavaScript, you will be able to easily learn Java's syntax and understand
the examples. Many modern programming languages have been
borrowing features from Java and vice versa. Therefore, any knowledge
of these languages will be extremely useful.
In this chapter, we will install the required software on Windows, macOS, or Linux.
We will understand the benefits of working with a REPL, specifically, JShell, to learn
object-oriented programming. We will learn how to run Java 9 code in the JShell and
how to load the source code samples in the REPL. Finally, we will learn how to run
Java code on Windows, macOS, and Linux from the command line or terminal.
[2]
Other documents randomly have
different content
CHAPTER VIII
THE LAND OF THE MANGROVE
SWAMPS
It was a long but a most interesting journey that the Doctor took
from Fantippo to Lake Junganyika. It turned out that the turtle's
home lay many miles inland in the heart of one of the wildest, most
jungly parts of Africa.
The Doctor decided to leave Gub-Gub home this time and he took
with him only Jip, Dab-Dab, Too-Too and Cheapside—who said he
wanted a holiday and that his sparrow friends could now quite well
carry on the city deliveries in his absence.
The great water snake began by taking the Doctor's party down the
coast south for some forty or fifty miles. There they left the sea,
entered the mouth of a river and started to journey inland. The
canoe (with the snake swimming alongside it) was quite the best
thing for this kind of travel so long as the river had water in it. But
presently, as they went up it, the stream grew narrower and
narrower. Till at last, like many rivers in tropical countries, it was
nothing more than the dry bed of a brook, or a chain of small pools
with long sand bars between.
Overhead the thick jungle arched and hung like a tunnel of green.
This was a good thing by day-time, as it kept the sun off better than
a parasol. And in the dry stretches of river bed, where the Doctor
had to carry or drag the canoe on home-made runners, the work
was hard and shade something to be grateful for.
At the end of the first day John Dolittle wanted to leave the canoe in
a safe place and finish the trip on foot. But the snake said they
would need it further on, where there was more water and many
swamps to cross.
As they went forward the jungle around them seemed to grow
thicker and thicker all the time. But there was always this clear alley-
way along the river bed. And though the stream's course did much
winding and twisting, the going was good.
The Doctor saw a great deal of new country, trees he had never met
before, gay-colored orchids, butterflies, ferns, birds and rare
monkeys. So his notebook was kept busy all the time with sketching
and jotting and adding to his already great knowledge of natural
history.
On the third day of travel this river bed led them into an entirely new
and different kind of country. If you have never been in a mangrove
swamp, it is difficult to imagine what it looks like. It was mournful
scenery. Flat bog land, full of pools and streamlets, dotted with tufts
of grass and weed, tangled with gnarled roots and brambling
bushes, spread out for miles and miles in every direction. It
reminded the Doctor of some huge shrubbery that had been flooded
by heavy rains. No large trees were here, such as they had seen in
the jungle lower down. Seven or eight feet above their heads was as
high as the mangroves grew and from their thin boughs long
streamers of moss hung like gray, fluttering rags.
The life, too, about them was quite different. The gayly colored birds
of the true forest did not care for this damp country of half water
and half land. Instead, all manner of swamp birds—big-billed and
long-necked, for the most part—peered at them from the sprawling
saplings. Many kinds of herons, egrets, ibises, grebes, bitterns—even
stately anhingas, who can fly beneath the water—were wading in
the swamps or nesting on the little tufty islands. In and out of the
holes about the gnarled roots strange and wondrous water creatures
—things half fish and half lizard—scuttled and quarreled with brightly
colored crabs.
For many folks it would have seemed a creepy, nightmary sort of
country, this land of the mangrove swamps. But to the Doctor, for
whom any kind of animal life was always companionable and good
intentioned, it was a most delightful new field of exploration.
They were glad now that the snake had not allowed them to leave
the canoe behind. For here, where every step you took you were
liable to sink down in the mud up to your waist, Jip and the Doctor
would have had hard work to get along at all without it. And, even
with it, the going was slow and hard enough. The mangroves spread
out long, twisting, crossing arms in every direction to bar your
passage—as though they were determined to guard the secrets of
this silent, gloomy land where men could not make a home and
seldom ever came.
Indeed, if it had not been for the giant water snake, to whom
mangrove swamps were the easiest kind of traveling, they would
never have been able to make their way forward. But their guide
went on ahead of them for hundreds of yards to lead the way
through the best openings and to find the passages where the water
was deep enough to float a canoe. And, although his head was out
of sight most of the time in the tangled distance, he kept, in the
worst stretches, a firm hold on the canoe by taking a turn about the
bowpost with his tail. And whenever they were stuck in the mud he
would contract that long, muscular body of his with a jerk and yank
the canoe forward as though it had been no more than a can tied on
the end of a string.
Dab-Dab, Too-Too and Cheapside did not, of course, bother to sit in
the canoe. They found flying from tree to tree a much easier way to
travel. But in one of these jerky pulls which the snake gave on his
living towline, the Doctor and Jip were left sitting in the mud as the
canoe was actually yanked from under them. This so much amused
the vulgar Cheapside, who was perched in a mangrove tree above
their heads, that he suddenly broke the solemn silence of the swamp
by bursting into noisy laughter.
"The canoe was yanked from under them"
"Lor' bless us, Doctor, but you do get yourself into some comical
situations! Who would think to see John Dolittle, M.D., heminent
physician of Puddleby-on-the-Marsh, bein' pulled through a mud
swamp in darkest Africa by a couple of 'undred yards of fat worm!
You've no idea how funny you look!"
"Oh, close your silly face!" growled Jip, black mud from head to foot,
scrambling back into the canoe. "It's easy for you—you can fly
through the mess."
"It 'ud make a nice football ground, this," murmured Cheapside. "I'm
surprised the Hafricans 'aven't took to it. I didn't know there was this
much mud anywhere—outside of 'Amstead 'Eath after a wet Bank
'Oliday. I wonder when we're going to get there. Seems to me we're
comin' to the end of the world—or the middle of it. 'Aven't seen a
'uman face since we left the shore. 'E's an exclusive kind of gent, our
Mr. Turtle, ain't 'e? Meself, I wouldn't be surprised if we ran into old
Noah, sitting on the wreck of the Hark, any minute.... 'Elp the Doctor
up, Jip. Look, 'e's got his chin caught under a root."
The snake, hearing Cheapside's chatter, thought something must be
wrong. He turned his head-end around and came back to see what
the matter was. Then a short halt was made in the journey while the
Doctor and Jip cleaned themselves up, and the precious notebooks,
which had also been jerked out into the mud, were rescued and
stowed in a safe place.
"Do no people at all live in these parts?" the Doctor asked the snake.
"None whatever," said the guide. "We left the lands where men dwell
behind us long ago. Nobody can live in these bogs but swamp birds,
marsh creatures and water snakes."
"How much further have we got to go?" asked the Doctor, rinsing
the mud off his hat in a pool.
"About one more day's journey," said the snake. "A wide belt of
these swamps surrounds the Secret Lake of Junganyika on all sides.
The going will become freer as we approach the open water of the
lake."
"We are really on the shores of it already, then?"
"Yes," said the serpent. "But, properly speaking, the Secret Lake
cannot be said to have shores at all—or, certainly, as you see, no
shore where a man can stand."
"Why do you call it the Secret Lake?" asked the Doctor.
"Because it has never been visited by man since the Flood," said the
giant reptile. "You will be the first to see it. We who live in it boast
that we bathe daily in the original water of the Flood. For before the
Forty Days' Rain came it was not there, they say. But when the Flood
passed away this part of the world never dried up. And so it has
remained, guarded by these wide mangrove swamps, ever since."
"What was here before the Flood then?" asked the Doctor.
"They say rolling, fertile country, waving corn and sunny hilltops,"
the snake replied. "That is what I have heard. I was not there to
see. Mudface, the turtle, will tell you all about it."
"How wonderful!" exclaimed the Doctor. "Let us push on. I am most
anxious to see him—and the Secret Lake."
CHAPTER IX
THE SECRET LAKE
During the course of the next day's travel the country became, as
the snake had foretold, freer and more open. Little by little the
islands grew fewer and the mangroves not so tangly. In the dreary
views there was less land and more water. The going was much
easier now. For miles at a stretch the Doctor could paddle, without
the help of his guide, in water that seemed to be quite deep. It was
indeed a change to be able to look up and see a clear sky overhead
once in a while, instead of that everlasting network of swamp trees.
Across the heavens the travelers now occasionally saw flights of wild
ducks and geese, winging their way eastward.
"That's a sign we're near open water," said Dab-Dab.
"Yes," the snake agreed. "They're going to Junganyika. It is the
feeding ground of great flocks of wild geese."
It was about five o'clock in the evening when they came to the end
of the little islands and mud banks. And as the canoe's nose glided
easily forward into entirely open water they suddenly found
themselves looking across a great inland sea.
The Doctor was tremendously impressed by his first sight of the
Secret Lake. If the landscape of the swamp country had been
mournful this was even more so. No eye could see across it. The
edge of it was like the ocean's—just a line where the heavens and
the water meet. Ahead to the eastward—the darkest part of the
evening sky—even this line barely showed, for now the murky
waters and the frowning night blurred together in an inky mass. To
the right and left the Doctor could see the fringe of the swamp trees
running around the lake, disappearing in the distance North and
South.
Out in the open great banks of gray mist rolled and joined and
separated as the wailing wind pushed them fretfully hither and
thither over the face of the waters.
"My word!" the Doctor murmured in a quiet voice. "Here one could
almost believe that the Flood was not over yet!"
"Jolly place, ain't it?" came Cheapside's cheeky voice from the stern
of the canoe. "Give me London any day—in the worst fog ever. This
is a bloomin' eels' country. Look at them mist shadows skatin' round
the lake. Might be old Noah and 'is family, playin' 'Ring-a-ring-a-rosy'
in their night-shirts, they're that lifelike."
"The mists are always there," said the snake—"always have been. In
them the first rainbow shone."
"Well," said the sparrow, "I'd sell the whole place cheap if it was
mine—mists and all. 'Ow many 'undred miles of this bonny blue
ocean 'ave we got to cross before we reach our Mr. Mudface?"
"Not very many," said the snake. "He lives on the edge of the lake a
few miles to the North. Let us hurry and try to reach his home
before darkness falls."
Once more, with the guide in front, but this time at a much better
pace, the party set off.
As the light grew dimmer the calls of several night birds sounded
from the mangroves on the left. Too-Too told the Doctor that many
of these were owls, but of kinds that he had never seen or met with
before.
"Yes," said the Doctor. "I imagine there are lots of different kinds of
birds and beasts in these parts that can be found nowhere else in
the world."
At last, while it was still just light enough to see, the snake swung
into the left and once more entered the outskirts of the mangrove
swamps. Following him with difficulty in the fading light, the Doctor
was led into a deep glady cove. At the end of this the nose of the
canoe suddenly bumped into something hard. The Doctor was about
to lean out to see what it was when a deep, deep bass voice spoke
out of the gloom quite close to him.
"Welcome, John Dolittle. Welcome to Lake Junganyika."
Then looking up, the Doctor saw on a mound-like island the shape of
an enormous turtle—fully twelve feet across the shell—standing
outlined against the blue-black sky.
The moon had now risen and the weird scenery of Junganyika was
all green lights and blue shadows. As the Doctor snuffed out his
candles and Jip curled himself up at his feet the turtle suddenly
started humming a tune in his deep bass voice, waving his long neck
from side to side in the moonlight.
"What is that tune you are humming?" asked the Doctor.
"That's the 'Elephants' March,'" said the turtle. "They always played
it at the Royal Circus of Shalba for the elephants' procession."
"Let's 'ope it 'asn't many verses," grumbled Cheapside, sleepily
putting his head under his wing.
The sun had not yet risen on the gloomy waters of Lake Junganyika
before Jip felt the Doctor stirring in his hammock, preparing to get
up.
Presently Dab-Dab could be heard messing about in the mud below,
bravely trying to get breakfast ready under difficult conditions.
Next Cheapside, grumbling in a sleepy chirp, brought his head out
from under his wing, gave the muddy scenery one look and popped
it back again.
But it was of little use to try to get more sleep now. The camp was
astir. John Dolittle, bent on the one idea of hearing that story, had
already swung himself out of his hammock and was now washing his
face noisily in the lake. Cheapside shook his feathers, swore a few
words in Cockney and flew off his tree down to the Doctor's side.
"The Doctor was washing his face in the lake"
"There isn't any other place I like as well," said Mudface. "It's so
hard to find a country where you're not disturbed these days."
"Here, drink this," the Doctor ordered, handing him a tea-cup full of
some brown mixture. "I think you will find that that will soon relieve
the stiffness in your front legs."
The turtle drank it down. And in a minute or two he said he felt
much better and could now move his legs freely without pain.
"It's a wonderful medicine, that," said he. "You are surely a great
Doctor. Have you got any more of it?"
"I will make up several bottles of the mixture and leave them with
you before I go," said John Dolittle. "But you really ought to get on
high ground somewhere. This muddy little hummock is no place for
you to live. Isn't there a regular island in the lake, where you could
make your home—if you're determined not to leave the Junganyika
country?"
"Not one," said the turtle. "It's all like this, just miles and miles of
mud and water. I used to like it—in fact I do still. I wouldn't wish for
anything better if it weren't for this wretched gout of mine."
"Well," said the Doctor, "if you haven't got an island we must make
one for you."
"Make one!" cried the turtle. "How would you go about it?"
"I'll show you very shortly," said John Dolittle. And he called
Cheapside to him.
"Will you please fly down to Fantippo," he said to the City Manager,
"and give this message to Speedy-the-Skimmer. And ask him to send
it out to all the postmasters of the branch offices: The Swallow Mail
is very shortly to be closed—at all events for a considerable time. I
must now be returning to Puddleby and it will be impossible for me
to continue the service in its present form after I have left No-Man's-
Land. I wish to convey my thanks to all the birds, postmasters,
clerks and letter-carriers who have so generously helped me in this
work. The last favor which I am going to ask of them is a large one;
and I hope they will give me their united support in it. I want them
to build me an island in the middle of Lake Junganyika. It is for
Mudface the turtle, the oldest animal living, who in days gone by did
a very great deal for man and beast—for the whole world in fact—
when the earth was passing through the darkest chapters in all its
history. Tell Speedy to send word to all bird leaders throughout the
world. Tell him I want as many birds as possible right away to build
a healthy home where this brave turtle may end his long life in
peace. It is the last thing I ask of the post office staff and I hope
they will do their best for me."
Cheapside said that the message was so long he was afraid he
would never be able to remember it by heart. So John Dolittle told
him to take it down in bird scribble and he dictated it to him all over
again.
That letter, the last circular order issued by the great Postmaster
General to the staff of the Swallow Mail, was treasured by Cheapside
for many years. He hid it under his untidy nest in St. Edmund's left
ear on the south side of the chancel of St. Paul's Cathedral. He
always hoped that the pigeons who lived in the front porch of the
British Museum would some day get it into the Museum for him. But
one gusty morning, when men were cleaning the outside of the
cathedral, it got blown out of St. Edmund's ear and, before
Cheapside could overtake it, it sailed over the housetops into the
river and sank.
The sparrow got back to Junganyika late that afternoon. He reported
that Speedy had immediately, on receiving the Doctor's message,
forwarded it to the postmasters of the branch offices with orders to
pass it on to all the bird-leaders everywhere. It was expected that
the first birds would begin to arrive here early the following morning.
It was Speedy himself who woke the Doctor at dawn the next day.
And while breakfast was being eaten he explained to John Dolittle
the arrangements that had been made.
The work, the Skimmer calculated, would take three days. All birds
had been ordered to pick up a stone or a pebble or a pinch of sand
from the seashore on their way and bring it with them. The larger
birds (who would carry stones) were to come first, then the middle-
sized birds and then the little ones with sand.
Soon, when the sky over the lake was beginning to fill up with
circling ospreys, herons and albatrosses, Speedy left the Doctor and
flew off to join them. There, taking up a position in the sky right
over the centre of the lake, he hovered motionless, as a marker for
the stone-droppers. Then the work began.
All day long a never-ending stream of big birds, a dozen abreast,
flew up from the sea and headed across Lake Junganyika. The line
was like a solid black ribbon, the birds, dense, packed and close,
beak to tail. And as each dozen reached the spot where Speedy
hovered, twelve stones dropped into the water. The procession was
so continuous and unbroken that it looked as though the sky were
raining stones. And the constant roar of them splashing into the
water out of the heavens could be heard a mile off.
The excellent postal service continued after he left. The stamps with
Koko's face on them were as various and as beautiful as ever. On the
occasion of the first annual review of the Fantippo Merchant Fleet a
very fine two-shilling stamp was struck in commemoration, showing
His Majesty inspecting his new ships through a lollipop quizzing-
glass. The King himself became a stamp-collector and his album was
as good as a family photo-album, containing as it did so many
pictures of himself. The only awkward incident that happened in the
record of the post office which the Doctor had done so much to
improve was when some ardent stamp-collectors, wishing to make
the modern stamps rare, plotted to have the King assassinated in
order that the current issues should go out of date. But the plot was
happily discovered before any harm was done.
Years afterwards, the birds visiting Puddleby told the Doctor that the
King still had the flowers in the window-boxes of his old houseboat
carefully tended and watered in his memory. His Majesty, they said,
never gave up the fond hope that some day his good white friend
would come back to Fantippo with his kindly smile, his instructive
conversation and his jolly tea-parties on the post office veranda.
THE END
*** END OF THE PROJECT GUTENBERG EBOOK DOCTOR
DOLITTLE'S POST OFFICE ***
Updated editions will replace the previous one—the old editions will
be renamed.
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