(eBook PDF) Introduction to Java Programming and Data Structures, Comprehensive Version, 11th Global Edition download
(eBook PDF) Introduction to Java Programming and Data Structures, Comprehensive Version, 11th Global Edition download
https://ebookluna.com/product/ebook-pdf-introduction-to-java-
programming-and-data-structures-comprehensive-version-11th-
global-edition/
https://ebookluna.com/product/ebook-pdf-introduction-to-java-
programming-and-data-structures-comprehensive-version-11/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-introduction-to-java-
programming-brief-version-global-edition-11th-edition/
ebookluna.com
https://ebookluna.com/download/introduction-to-java-programming-
comprehensive-version-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-java-foundations-introduction-
to-program-design-and-data-structures-5th-edition/
ebookluna.com
(eBook PDF) Data Structures and Abstractions with Java 4th
Global Edition
https://ebookluna.com/product/ebook-pdf-data-structures-and-
abstractions-with-java-4th-global-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-data-structures-and-
abstractions-with-java-4th-edition/
ebookluna.com
https://ebookluna.com/product/data-structures-and-abstractions-with-
java-5th-edition-ebook-pdf/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-data-structures-and-other-
objects-using-java-4th-edition/
ebookluna.com
https://ebookluna.com/product/ebook-pdf-data-structures-and-problem-
solving-using-java-4th-edition/
ebookluna.com
6 Preface
Part I: Fundamentals of Part II: Object-Oriented Part III: GUI Programming Part IV: Data Structures and Part V: Advanced Java
Programming Programming Algorithms Ch 16 Programming
Chapter 1 Introduction to Chapter 9 Objects and Classes Chapter 14 JavaFX Basics Ch 7 Chapter 18 Recursion Chapter 32 Multithreading and
Computers, Programs, and Parallel Programming
Java
Chapter 10 Thinking in Objects Chapter 15 Event-Driven Ch 13 Chapter 19 Generics
Programming and Chapter 33 Networking
Chapter 2 Elementary Animations
Chapter 11 Inheritance and Chapter 20 Lists, Stacks, Queues,
Programming
Polymorphism and Priority Queues Chapter 34 Java Database
Chapter 16 JavaFX Controls Programming
Chapter 3 Selections and Multimedia
Chapter 12 Exception Chapter 21 Sets and Maps
Handling and Text I/O Chapter 35 Advanced Database
Chapter 4 Mathematical Chapter 31 Advanced JavaFX Programming
Chapter 22 Developping
Functions, Characters, Chapter 13 Abstract Classes and FXML Efficient Algorithms
and Strings and Interfaces Chapter 36 Internationalization
Chapter 23 Sorting
Chapter 5 Loops Chapter 17 Binary I/O Chapter 37 Servlets
Chapter 24 Implementing Lists,
Chapter 6 Methods Stacks, Queues, and Priority Chapter 38 JavaServer Pages
Queues
Part III: GUI Programming (Chapters 14–16 and Bonus Chapter 31)
JavaFX is a new framework for developing Java GUI programs. It is not only useful for
developing GUI programs, but also an excellent pedagogical tool for learning object-oriented
programming. This part introduces Java GUI programming using JavaFX in Chapters 14–16.
Major topics include GUI basics (Chapter 14), container panes (Chapter 14), drawing shapes
(Chapter 14), event-driven programming (Chapter 15), animations (Chapter 15), and GUI
controls (Chapter 16), and playing audio and video (Chapter 16). You will learn the a rchitecture
of JavaFX GUI programming and use the controls, shapes, panes, image, and video to develop
useful applications. Chapter 31 covers advanced features in JavaFX.
Part IV: Data Structures and Algorithms (Chapters 18–30 and Bonus Chapters 42–43)
This part covers the main subjects in a typical data structures and algorithms course. Chapter 18
introduces recursion to write methods for solving inherently recursive problems. Chapter 19 presents
how generics can improve software reliability. Chapters 20 and 21 introduce the Java Collection
Framework, which defines a set of useful API for data structures. Chapter 22 discusses measur-
ing algorithm efficiency in order to choose an appropriate algorithm for applications. Chapter 23
describes classic sorting algorithms. You will learn how to implement several classic data struc-
tures lists, queues, and priority queues in Chapter 24. Chapters 25 and 26 introduce binary search
trees and AVL trees. Chapter 27 presents hashing and implementing maps and sets using hashing.
Chapters 28 and 29 introduce graph applications. Chapter 30 introduces aggregate operations for
collection streams. The 2-4 trees, B-trees, and red-black trees are covered in Bonus Chapters 42–43.
Appendixes
This part of the book covers a mixed bag of topics. Appendix A lists Java keywords. Appendix B
gives tables of ASCII characters and their associated codes in decimal and in hex. Appen-
dix C shows the operator precedence. Appendix D summarizes Java modifiers and their usage.
Appendix E discusses special floating-point values. Appendix F introduces number systems and
conversions among binary, decimal, and hex numbers. Finally, Appendix G introduces bitwise
operations. Appendix H introduces regular expressions. Appendix I covers enumerated types.
Student Resources
The Companion Website (www.pearsonglobaleditions.com/Liang) contains the following
resources:
■■ Answers to CheckPoint questions
■■ Solutions to majority of even-numbered programming exercises
■■ Source code for the examples in the book
■■ Interactive quiz (organized by sections for each chapter)
■■ Supplements
■■ Debugging tips
■■ Video notes
■■ Algorithm animations
Supplements
The text covers the essential subjects. The supplements extend the text to introduce additional
topics that might be of interest to readers. The supplements are available from the Companion
Website.
Preface 9
Instructor Resources
The Companion Website, accessible from www.pearsonglobaleditions.com/Liang, contains the
following resources:
■■ Microsoft PowerPoint slides with interactive buttons to view full-color, syntax-highlighted
source code and to run programs without leaving the slides.
■■ Solutions to a majority of odd-numbered programming exercises.
■■ More than 200 additional programming exercises and 300 quizzes organized by chapters.
These exercises and quizzes are available only to the instructors. Solutions to these
exercises and quizzes are provided.
■■ Web-based quiz generator. (Instructors can choose chapters to generate quizzes from a
large database of more than two thousand questions.)
■■ Sample exams. Most exams have four parts:
■■ Multiple-choice questions or short-answer questions
■■ Correct programming errors
■■ Trace programs
■■ Write programs
■■ Sample exams with ABET course assessment.
■■ Projects. In general, each project gives a description and asks students to analyze, design,
and implement the project.
Some readers have requested the materials from the Instructor Resource Center. Please
understand that these are for instructors only. Such requests will not be answered.
Video Notes
We are excited about the new Video Notes feature that is found in this new edition. These VideoNote
videos provide additional help by presenting examples of key topics and showing how
to solve problems completely from design through coding. Video Notes are available from
www.pearsonglobaleditions.com/Liang.
10 Preface
Algorithm Animations
Animation We have provided numerous animations for algorithms. These are valuable pedagogical tools
to demonstrate how algorithms work. Algorithm animations can be accessed from the Com-
panion Website.
Acknowledgments
I would like to thank Armstrong State University for enabling me to teach what I write and for
supporting me in writing what I teach. Teaching is the source of inspiration for continuing to
improve the book. I am grateful to the instructors and students who have offered comments,
suggestions, corrections, and praise. My special thanks go to Stefan Andrei of Lamar Univer-
sity and William Bahn of University of Colorado Colorado Springs for their help to improve
the data structures part of this book.
This book has been greatly enhanced thanks to outstanding reviews for this and previous edi-
tions. The reviewers are: Elizabeth Adams (James Madison University), Syed Ahmed (North
Georgia College and State University), Omar Aldawud (Illinois Institute of Technology), Ste-
fan Andrei (Lamar University), Yang Ang (University of Wollongong, Australia), Kevin Bierre
(Rochester Institute of Technology), Aaron Braskin (Mira Costa High School), David Champion
(DeVry Institute), James Chegwidden (Tarrant County College), Anup Dargar (University of North
Dakota), Daryl Detrick (Warren Hills Regional High School), Charles Dierbach (Towson Univer-
sity), Frank Ducrest (University of Louisiana at Lafayette), Erica Eddy (University of Wisconsin at
Parkside), Summer Ehresman (Center Grove High School), Deena Engel (New York University),
Henry A. Etlinger (Rochester Institute of Technology), James Ten Eyck (Marist College), Myers
Foreman (Lamar University), Olac Fuentes (University of Texas at El Paso), Edward F. Gehringer
(North Carolina State University), Harold Grossman (Clemson University), Barbara Guillot (Loui-
siana State University), Stuart Hansen (University of Wisconsin, Parkside), Dan Harvey (Southern
Oregon University), Ron Hofman (Red River College, Canada), Stephen Hughes (Roanoke Col-
lege), Vladan Jovanovic (Georgia Southern University), Deborah Kabura Kariuki (Stony Point
High School), Edwin Kay (Lehigh University), Larry King (University of Texas at Dallas), Nana
Kofi (Langara College, Canada), George Koutsogiannakis (Illinois Institute of Technology), Roger
Kraft (Purdue University at Calumet), Norman Krumpe (Miami University), Hong Lin (DeVry
Institute), Dan Lipsa (Armstrong State University), James Madison (Rensselaer Polytechnic Insti-
tute), Frank Malinowski (Darton College), Tim Margush (University of Akron), Debbie Masada
(Sun Microsystems), Blayne Mayfield (Oklahoma State University), John McGrath (J.P. McGrath
Consulting), Hugh McGuire (Grand Valley State), Shyamal Mitra (University of Texas at Austin),
Michel Mitri (James Madison University), Kenrick Mock (University of Alaska Anchorage), Frank
Murgolo (California State University, Long Beach), Jun Ni (University of Iowa), Benjamin N ystuen
(University of Colorado at Colorado Springs), Maureen Opkins (CA State University, Long Beach),
Gavin Osborne (University of Saskatchewan), Kevin Parker (Idaho State University), Dale Par-
son (Kutztown University), Mark Pendergast (Florida Gulf Coast University), Richard Povinelli
(Marquette University), Roger Priebe (University of Texas at Austin), Mary Ann Pumphrey (De
Anza Junior College), Pat Roth (Southern Polytechnic State University), Amr Sabry (Indiana Uni-
versity), Ben Setzer (Kennesaw State University), Carolyn Schauble (Colorado State University),
David Scuse (University of Manitoba), Ashraf Shirani (San Jose State University), Daniel Spiegel
(Kutztown University), Joslyn A. Smith (Florida Atlantic University), Lixin Tao (Pace University),
Ronald F. Taylor (Wright State University), Russ Tront (Simon Fraser University), Deborah Trytten
(University of Oklahoma), Michael Verdicchio (Citadel), Kent Vidrine (George Washington Uni-
versity), and Bahram Zartoshty (California State University at Northridge).
It is a great pleasure, honor, and privilege to work with Pearson. I would like to thank Tracy
Johnson and her colleagues Marcia Horton, Demetrius Hall, Yvonne Vannatta, Kristy Alaura,
Carole Snyder, Scott Disanno, Bob Engelhardt, Shylaja Gattupalli, and their colleagues for
organizing, producing, and promoting this project.
As always, I am indebted to my wife, Samantha, for her love, support, and encouragement.
Preface 11
Chapter 3 Selections 97
3.1 Introduction 98
3.2 boolean Data Type 98
3.3 if Statements 100
3.4 Two-Way if-else Statements 102
3.5 Nested if and Multi-Way if-else Statements 103
3.6 Common Errors and Pitfalls 105
3.7 Generating Random Numbers 109
3.8 Case Study: Computing Body Mass Index 111
3.9 Case Study: Computing Taxes 112
3.10 Logical Operators 115
3.11 Case Study: Determining Leap Year 119
3.12 Case Study: Lottery 120
3.13 switch Statements 122
12
Contents 13
3.14 Conditional Operators 125
3.15 Operator Precedence and Associativity 126
3.16 Debugging 128
Chapter 20 L
ists, Stacks, Queues, and
Priority Queues 797
20.1 Introduction 798
20.2 Collections 798
20.3 Iterators 802
20.4 Using the forEach Method 803
20.5 Lists 804
20.6 The Comparator Interface 809
20.7 Static Methods for Lists and Collections 813
20.8 Case Study: Bouncing Balls 816
20.9 Vector and Stack Classes 820
20.10 Queues and Priority Queues 821
20.11 Case Study: Evaluating Expressions 825
Chapter 29 W
eighted Graphs and
Applications 1107
29.1 Introduction 1108
29.2 Representing Weighted Graphs 1109
29.3 The WeightedGraph Class 1111
29.4 Minimum Spanning Trees 1119
29.5 Finding Shortest Paths 1125
29.6 Case Study: The Weighted Nine Tails Problem 1134
Chapter 30
Aggregate Operations
for Collection Streams 1145
30.1 Introduction 1146
30.2 Stream Pipelines 1146
30.3 IntStream, LongStream, and DoubleStream 1152
30.4 Parallel Streams 1155
30.5 Stream Reduction Using the reduce Method 1157
30.6 Stream Reduction Using the collect Method 1160
30.7 Grouping Elements Using the groupingby Collector 1163
30.8 Case Studies 1166
Appendixes 1177
Appendix A Java Keywords 1179
Appendix B The ASCII Character Set 1180
Appendix C Operator Precedence Chart 1182
Appendix D Java Modifiers 1184
Appendix E Special Floating-Point Values 1186
Appendix F Number Systems 1187
Appendix G Bitwise Operations 1191
Appendix H Regular Expressions 1192
Appendix I Enumerated Types 1197
Animations
1
Introduction
to Computers,
Programs, and Java™
Objectives
■■ To understand computer basics, programs, and operating systems
(§§1.2–1.4).
■■ To describe the relationship between Java and the World Wide Web
(§1.5).
■■ To understand the meaning of Java language specification, API, JDK™,
JRE™, and IDE (§1.6).
■■ To write a simple Java program (§1.7).
■■ To display output on the console (§1.7).
■■ To explain the basic syntax of a Java program (§1.7).
■■ To create, compile, and run Java programs (§1.8).
■■ To use sound Java programming style and document programs properly
(§1.9).
■■ To explain the differences between syntax errors, runtime errors, and
logic errors (§1.10).
■■ To develop Java programs using NetBeans™ (§1.11).
■■ To develop Java programs using Eclipse™ (§1.12).
Other documents randomly have
different content
several people were killed, and one dragged by the legs to the
palace. The mob by the 20th were very unruly, and insisted the
Royal Family should not leave Naples; however, they were pacified
by the King and Queen speaking to them.
“On the 21st, at half-past 8 P.M., three Barges with myself and
Captain Hope, landed at a corner of the Arsenal. I went into the
palace and brought out the whole Royal Family, put them into the
Boats, and at half-past nine they were all safely on board the
Vanguard, when I gave immediate notice to all British Merchants
that their persons would be received on board every and any Ship in
the Squadron, their effects of value being before embarked in the
three English transports who were partly unloaded, and I had
directed that all the condemned provisions should be thrown
overboard, in order to make room for their effects. Sir William
Hamilton had also directed two Vessels to be hired for the
39
accommodation of the French emigrants, and provisions were
supplied from our Victuallers; in short, everything had been done for
the comfort of all persons embarked.
“I did not forget in these important moments that it was my duty
not to leave the chance of any Ships of War falling into the hands of
the French, therefore, every preparation was made for burning them
before I sailed; but the reasons given me by their Sicilian Majesties,
induced me not to burn them till the last moment. I, therefore,
directed the Marquis de Niza to remove all the Neapolitan Ships
outside the Squadron under his command, and if it was possible, to
equip some of them with jury masts and send them to Messina; and
whenever the French advanced near Naples, or the people revolted
against their legitimate Government, immediately to destroy the
Ships of War, and to join me at Palermo, leaving one or two Ships to
cruize between Capri and Ischia in order to prevent the entrance of
any English Ship into the Bay of Naples. On the 23rd, at 7 P.M., the
Vanguard, Sannite, and Archimedes, with about twenty sail of
Vessels left the Bay of Naples; the next day it blew harder than I
ever experienced since I have been at sea. Your Lordship will believe
that my anxiety was not lessened by the great charge that was with
me, but not a word of uneasiness escaped the lips of any of the
Royal Family. On the 25th, at 9 A.M., Prince Albert, their Majesties’
youngest child, having eat a hearty breakfast, was taken ill, and at 7
P.M. died in the arms of Lady Hamilton; and here it is my duty to tell
your Lordship the obligations which the whole Royal Family as well
as myself are under on this trying occasion to her Ladyship.... Lady
Hamilton provided her own beds, linen, &c., and became their slave,
for except one man, no person belonging to Royalty assisted the
Royal Family, nor did her Ladyship enter a bed the whole time they
were on board. Good Sir William also made every sacrifice for the
comfort of the august Family embarked with him. I must not omit to
state the kindness of Captain Hardy and every Officer in the
Vanguard, all of whom readily gave their beds for the convenience of
the numerous persons attending the Royal Family.
“At 3 P.M., being in sight of Palermo, his Sicilian Majesty’s Royal
Standard was hoisted at the main-top gallant-mast head of the
Vanguard, which was kept flying there till his Majesty got into the
Vanguard’s barge, when it was struck in the Ship and hoisted in the
Barge, and every proper honour paid to it from the Ship. As soon as
his Majesty set his foot on shore, it was struck from the Barge. The
Vanguard anchored at 2 A.M. of the 26th; at 5, I attended her
Majesty and all the Princesses on shore; her Majesty being so much
affected by the death of Prince Albert that she could not bear to go
on shore in a public manner. At 9 A.M., his Majesty went on shore,
and was received with the loudest acclamations and apparent joy.”
Alas, that one has to admit that while Lady Hamilton was the
“slave” of the Sicilian Royal Family, Nelson was rapidly becoming so
infatuated that the same word might be used to describe his
relationship with “our dear invaluable Lady Hamilton”! He also seems
to have had an exaggerated sense of the importance of the princely
personages who had placed themselves under his protection. In his
letters he speaks of “The good and amiable Queen,” “the great
Queen,” and so on. “I am here,” he writes to Captain Ball, of the
Alexander, dated Palermo, January 21st, 1799, “nor will the King or
Queen allow me to move. I have offered to go to Naples, and have
wished to go off Malta in case the Squadron from Brest should get
near you, but neither one or the other can weigh with them.” To Earl
Spencer he confides on the 6th March, “In Calabria the people have
cut down the Tree of Liberty; but I shall never consider any part of
the Kingdom of Naples safe, or even Sicily, until I hear of the
Emperor’s entering Italy, when all my Ships shall go into the Bay of
Naples, and I think we can make a Revolution against the French—at
least, my endeavours shall not be wanting. I hope to go on the
service myself, but I have my doubts if the King and Queen will
consent to my leaving them for a moment.” On the 20th of the same
month he tells St Vincent very much the same thing. “If the Emperor
moves, I hope yet to return the Royal Family to Naples. At present, I
cannot move. Would the Court but let me, I should be better, I
believe; for here I am writing from morn to eve: therefore you must
excuse this jumble of a letter.”
And after evening what? Rumour, not altogether devoid of fact,
told strange tales of gambling continued far into the night, of money
made and money lost, of an insidious enchantment which was
beginning to sully the fair soul of Britain’s greatest Admiral. How far
the influence of Lady Hamilton led Nelson to neglect his duty is a
debatable point. Admiral Mahan points out that on the 22nd October
1798, Nelson wrote to Lord St Vincent to the effect that he had
given up his original plan, “which was to have gone to Egypt and
attend to the destruction of the French shipping in that quarter,”
owing to the King’s desire that he should return to Naples, after
having arranged the blockade of Malta. This and similar expressions,
says Mahan, “show the anxiety of his mind acting against his
judgment.” The late Judge O’Connor Morris, commenting on this
phase of the Hero’s career, is most emphatic in his condemnation.
His connection with Emma Hamilton “kept him at Naples when he
ought to have been elsewhere; it led him to disobey a superior’s
orders, on one occasion when there was no excuse; it perhaps
prevented him from being present at the siege of Malta. It exposed
him, too, to just censure at home, and gave pain and offence to his
best friends; and the consciousness that he was acting wrongly
soured, in some degree, his nature, and made him morose and at
odds with faithful companions in arms.” For the defence there are no
more able advocates than Professor Sir J. Knox Laughton and Mr
James R. Thursfield, M.A. Nelson, the former asserts, “in becoming
the slave of a beautiful and voluptuous woman, did not cease to be
a great commander. There is a common idea that his passions
detained him at Naples to the neglect of his duty. This is erroneous.
He made Naples his headquarters because he was ordered to do so,
to provide for the safety of the kingdom and to take measures for
the reduction of Malta.” “The point to be observed and insisted on,”
Mr Thursfield says, “is that the whole of this pitiful tragedy belongs
only to the last seven years of Nelson’s life.” He asks, “Why should
the seven years of private lapse be allowed to overshadow the
splendid devotion of a lifetime to public duty?” This authority does
not deny that during the two years following the victory of the Nile
Nelson’s genius “suffered some eclipse,” that his passion for Lady
Hamilton was then “in its first transports, when he seemed tied to
the Court of the Two Sicilies by other bonds than those of duty,
when he annulled the capitulation at Naples and insisted on the trial
40
and execution of Caracciolo, and when he repeatedly disobeyed
the orders of Lord Keith.” He further points out that the period is the
same “during which his mental balance was more or less disturbed
by the wound he had received at the Nile, and his amour-propre was
deeply and justly mortified by the deplorable blunder of the
Admiralty in appointing Lord Keith to the chief command in
succession to Lord St Vincent.” At the time with which we are now
dealing the latter disturbing element was not present, although he
was considerably worried by the appointment of Captain Sir Sidney
Smith as commander of a squadron in the Levant, “within the district
which I had thought under my command.” “The Knight forgets the
respect due to his superior Officer”: Nelson tells Lord St Vincent, “he
has no orders from you to take my Ships away from my command;
but it is all of a piece. Is it to be borne? Pray grant me your
permission to retire, and I hope the Vanguard will be allowed to
convey me and my friends, Sir William and Lady Hamilton, to
England.” Mr Thursfield makes no mention of this vexation, perhaps
because the matter distressed the Admiral less than Lord Keith’s
appointment. On the other hand, Nelson’s correspondence contains
frequent reference to the gratuitous snub, which shows how deeply
the iron had entered into his soul. “I do feel, for I am a man, that it
is impossible for me to serve in these seas, with the Squadron under
a junior Officer:—could I have thought it!—and from Earl Spencer!”
is a typical instance. In the opinion of the same biographer, “the
influence of Lady Hamilton, which ceased only with Nelson’s life,
cannot have been the sole cause, even if it was a contributory
cause, of an attitude and temper of mind which lasted only while
other causes were in operation and disappeared with their cessation.
The evil spirit which beset him, whatever it may have been, had
41
been exorcised for ever by the time that he entered the Sound. ...
Yet the influence of Lady Hamilton was not less potent then and
afterward than it was during the period of eclipse. There are no
letters in the Morrison Collection more passionate than those which
Nelson wrote to Lady Hamilton at this time, none which show more
clearly that, as regards Lady Hamilton, and yet only in that relation,
his mental balance was still more than infirm, his moral fibre utterly
disorganized.”
With this verdict the present writer is in complete accord. Nelson
is to be censured for his moral breach and any neglect of duty which
may be traceable to it, but to condemn him to infamy is to forget his
subsequent career and to consign to the flames many other great
figures of history.
CHAPTER XI
I
n the middle of March 1799 Troubridge returned from the
Levant, his command there having been given to Sir Sidney
Smith. Vexatious as was the arrangement to both Nelson and
Lord St Vincent, it had one point of importance in its favour—and
was to have far-reaching results later—in that it enabled the Admiral
to send the trusted captain with several vessels to blockade Naples.
Troubridge was to “seize and get possession” of the islands of
Procida, Ischia, and Capri, to use his influence with the inhabitants
there and elsewhere, “in order to induce them to return to their
allegiance to his Sicilian Majesty, and to take arms to liberate their
Country from French tyranny and oppressive contributions.” On the
3rd April, Troubridge was able to tell Nelson that “All the Ponza
Islands have the Neapolitan flag flying. Your Lordship never beheld
such loyalty; the people are perfectly mad with joy, and are asking
for their beloved Monarch.” That Nelson’s hands were “full,” as he
wrote to his brother, is sufficiently evident. He had become “a
Councillor and Secretary of State,” to use his own words, and his
public correspondence, “besides the business of sixteen Sail of the
Line, and all our commerce, is with Petersburg, Constantinople, the
Consul at Smyrna, Egypt, the Turkish and Russian Admirals, Trieste,
Vienna, Tuscany, Minorca, Earl St Vincent and Lord Spencer.”
Moreover, he was now Commander-in-Chief of the Neapolitan Navy,
and had been promoted to Rear-Admiral of the Red. His health
during this trying period was far from good. He complained to his
friend the Duke of Clarence of being “seriously unwell,” and he told
Lord St Vincent, “I am almost blind and worn out, and cannot, in my
present state, hold out much longer.” He seemed to be growing
more despondent daily, the good news of the success of the Austrian
arms in Italy “does not even cheer me.”
“The great object of the war is—Down, down with the French.”
Nelson.
K
ing Ferdinand was again on board the Foudroyant, holding
his Levées on the quarter-deck, and making himself as
affable as was possible to a man of his morose
temperament. Nelson’s infatuation for the welfare of his Majesty and
his kingdom seemed growing. The castle of St Elmo had fallen,
thereby completing the conquest of Naples, but the Admiral saw fit
to order Troubridge to march against Capua, thereby denuding the
fleet of a thousand men, who were to act in concert with four times
that number of troops. This was done after the receipt of a warning
from Keith that it might be necessary to withdraw the squadron for
the protection of Minorca.
Disobedience to Orders
M
alta was in a pitiful, half-starved condition. Nelson urged Sir
James Erskine at Mahon, and Brigadier-General Graham
at Messina, to send troops to its relief. They were as
adamant and refused. He was therefore kept “in desperation about
Malta” until General Fox arrived at Minorca and released the garrison
there for the more urgent necessities of the unhappy island. The
Russians upon whom the Admiral had also depended were sent
elsewhere in pursuance of the Czar’s plan to withdraw from the
enfeebled coalition.