100% found this document useful (2 votes)
21 views

Learning Java An Introduction to Real World Programming with Java Marc Loy - The ebook is ready for instant download and access

The document promotes a collection of Java programming ebooks available for download at textbookfull.com, including titles like 'Learning Java: An Introduction to Real World Programming' by Marc Loy and 'Java Coding Problems' by Anghel Leonard. It provides links to various editions and related resources for learning Java, catering to different skill levels. The content also outlines the structure of the book, covering topics from basic Java concepts to advanced programming techniques.

Uploaded by

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

Learning Java An Introduction to Real World Programming with Java Marc Loy - The ebook is ready for instant download and access

The document promotes a collection of Java programming ebooks available for download at textbookfull.com, including titles like 'Learning Java: An Introduction to Real World Programming' by Marc Loy and 'Java Coding Problems' by Anghel Leonard. It provides links to various editions and related resources for learning Java, catering to different skill levels. The content also outlines the structure of the book, covering topics from basic Java concepts to advanced programming techniques.

Uploaded by

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

Explore the full ebook collection and download it now at textbookfull.

com

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/

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

Learning Java An Introduction to Real World Programming


with Java 5th Edition Marc Loy

https://textbookfull.com/product/learning-java-an-introduction-to-
real-world-programming-with-java-5th-edition-marc-loy/

textbookfull.com

Learning Java Beginning programming with java for dummies


First Edition John Bach

https://textbookfull.com/product/learning-java-beginning-programming-
with-java-for-dummies-first-edition-john-bach/

textbookfull.com

Introduction to Programming in Java An Interdisciplinary


Approach 2nd Edition Robert Sedgewick

https://textbookfull.com/product/introduction-to-programming-in-java-
an-interdisciplinary-approach-2nd-edition-robert-sedgewick/

textbookfull.com

Java An Introduction to Problem Solving and Programming


8th Edition Walter Savitch

https://textbookfull.com/product/java-an-introduction-to-problem-
solving-and-programming-8th-edition-walter-savitch/

textbookfull.com
Learning Network Programming with Java 1st Edition Reese
Richard M

https://textbookfull.com/product/learning-network-programming-with-
java-1st-edition-reese-richard-m/

textbookfull.com

Learning Java With Games Chong-Wei Xu

https://textbookfull.com/product/learning-java-with-games-chong-wei-
xu/

textbookfull.com

Learning Java Functional Programming 1st Edition Reese


Richard M

https://textbookfull.com/product/learning-java-functional-
programming-1st-edition-reese-richard-m/

textbookfull.com

Java Coding Problems: Become an expert Java programmer by


solving over 200 brand-new, modern, real-world problems,
2nd edition Anghel Leonard
https://textbookfull.com/product/java-coding-problems-become-an-
expert-java-programmer-by-solving-over-200-brand-new-modern-real-
world-problems-2nd-edition-anghel-leonard/
textbookfull.com

Java Coding Problems, 2nd Edition: Become an expert Java


programmer by solving over 200 brand-new, modern, real-
world problems Anghel Leonard
https://textbookfull.com/product/java-coding-problems-2nd-edition-
become-an-expert-java-programmer-by-solving-over-200-brand-new-modern-
real-world-problems-anghel-leonard/
textbookfull.com
1. Preface
a. Who Should Read This Book
b. New Developments
i. New in This Edition (Java 11, 12, 13,
14)

c. Using This Book


d. Online Resources
e. Conventions Used in This Book
f. Using Code Examples
g. O’Reilly Online Learning
h. How to Contact Us
i. Acknowledgments

2. 1. A Modern Language

a. Enter Java

i. Java’s Origins
ii. Growing Up

b. A Virtual Machine
c. Java Compared with Other Languages
d. Safety of Design
i. Simplify, Simplify, Simplify…
ii. Type Safety and Method Binding
iii. Incremental Development
iv. Dynamic Memory Management

2
v. Error Handling
vi. Threads
vii. Scalability

e. Safety of Implementation

i. The Verifier
ii. Class Loaders
iii. Security Managers

f. Application and User-Level Security


g. A Java Road Map

i. The Past: Java 1.0–Java 11


ii. The Present: Java 14
iii. The Future
iv. Availability

3. 2. A First Application
a. Java Tools and Environment

i. Installing the JDK


ii. Installing OpenJDK on Linux
iii. Installing OpenJDK on macOS
iv. Installing OpenJDK on Windows
v. Configuring IntelliJ IDEA and
Creating a Project
vi. Running the Project
vii. Grabbing the Learning Java Examples
b. HelloJava

3
i. Classes
ii. The main() Method
iii. Classes and Objects
iv. Variables and Class Types
v. HelloComponent
vi. Inheritance
vii. The JComponent Class
viii. Relationships and Finger-Pointing
ix. Package and Imports
x. The paintComponent() Method
c. HelloJava2: The Sequel

i. Instance Variables
ii. Constructors
iii. Events
iv. The repaint() Method
v. Interfaces

d. Goodbye and Hello Again


4. 3. Tools of the Trade

a. JDK Environment
b. The Java VM
c. Running Java Applications
i. System Properties

d. The Classpath
i. javap

4
ii. Modules
e. The Java Compiler
f. Trying Java
g. JAR Files

i. File Compression
ii. The jar Utility
iii. The pack200 Utility

h. Building Up

5. 4. The Java Language

a. Text Encoding
b. Comments

i. Javadoc Comments

c. Variables and Constants


d. Types
i. Primitive Types
ii. Reference Types
iii. Inferring Types
iv. Passing References
v. A Word About Strings
e. Statements and Expressions

i. Statements
ii. Expressions

f. Arrays
i. Array Types

5
ii. Array Creation and Initialization
iii. Using Arrays
iv. Anonymous Arrays
v. Multidimensional Arrays
g. Types and Classes and Arrays, Oh My!

6. 5. Objects in Java

a. Classes

i. Declaring and Instantiating Classes


ii. Accessing Fields and Methods
iii. Static Members

b. Methods

i. Local Variables
ii. Shadowing
iii. Static Methods
iv. Initializing Local Variables
v. Argument Passing and References
vi. Wrappers for Primitive Types
vii. Method Overloading

c. Object Creation

i. Constructors
ii. Working with Overloaded
Constructors

d. Object Destruction
i. Garbage Collection

6
e. Packages
i. Importing Classes
ii. Custom Packages
iii. Member Visibility and Access
iv. Compiling with Packages
f. Advanced Class Design

i. Subclassing and Inheritance


ii. Interfaces
iii. Inner Classes
iv. Anonymous Inner Classes
g. Organizing Content and Planning for Failure

7. 6. Error Handling and Logging

a. Exceptions

i. Exceptions and Error Classes


ii. Exception Handling
iii. Bubbling Up
iv. Stack Traces
v. Checked and Unchecked Exceptions
vi. Throwing Exceptions
vii. try Creep
viii. The finally Clause
ix. try with Resources
x. Performance Issues

b. Assertions

7
i. Enabling and Disabling Assertions
ii. Using Assertions
c. The Logging API

i. Overview
ii. Logging Levels
iii. A Simple Example
iv. Logging Setup Properties
v. The Logger
vi. Performance
d. Real-World Exceptions
8. 7. Collections and Generics

a. Collections
i. The Collection Interface
ii. Collection Types
iii. The Map Interface
b. Type Limitations

i. Containers: Building a Better


Mousetrap
ii. Can Containers Be Fixed?

c. Enter Generics
i. Talking About Types
d. “There Is No Spoon”

i. Erasure
ii. Raw Types

8
e. Parameterized Type Relationships

i. Why Isn’t a List<Date> a


List<Object>?
f. Casts
i. Converting Between Collections and
Arrays
ii. Iterator
g. A Closer Look: The sort() Method
h. Application: Trees on the Field
i. Conclusion

9. 8. Text and Core Utilities


a. Strings
i. Constructing Strings
ii. Strings from Things
iii. Comparing Strings
iv. Searching
v. String Method Summary
b. Things from Strings

i. Parsing Primitive Numbers


ii. Tokenizing Text
c. Regular Expressions

i. Regex Notation
ii. The java.util.regex API
d. Math Utilities

9
i. The java.lang.Math Class
ii. Big/Precise Numbers

e. Dates and Times


i. Local Dates and Times
ii. Comparing and Manipulating Dates
and Times
iii. Time Zones
iv. Parsing and Formatting Dates and
Times
v. Parsing Errors
vi. Timestamps

f. Other Useful Utilities


10. 9. Threads
a. Introducing Threads

i. The Thread Class and the Runnable


Interface
ii. Controlling Threads
iii. Death of a Thread
b. Synchronization
i. Serializing Access to Methods
ii. Accessing Class and Instance
Variables from Multiple Threads
c. Scheduling and Priority

i. Thread State
ii. Time-Slicing

10
iii. Priorities
iv. Yielding
d. Thread Performance

i. The Cost of Synchronization


ii. Thread Resource Consumption

e. Concurrency Utilities
11. 10. Desktop Applications
a. Buttons and Sliders and Text Fields, Oh My!

i. Component Hierarchies
ii. Model View Controller Architecture
iii. Labels and Buttons
iv. Text Components
v. Other Components

b. Containers and Layouts


i. Frames and Windows
ii. JPanel
iii. Layout Managers
c. Events

i. Mouse Events
ii. Action Events
iii. Change Events
iv. Other Events
d. Modals and Pop Ups
i. Message Dialogs

11
ii. Confirmation Dialogs
iii. Input Dialogs
e. Threading Considerations

i. SwingUtilities and Component


Updates
ii. Timers
f. Next Steps

i. Menus
ii. Preferences
iii. Custom Components and Java2D
iv. JavaFX
g. User Interface and User Experience

12. 11. Networking and I/O


a. Streams
i. Basic I/O
ii. Character Streams
iii. Stream Wrappers
iv. The java.io.File Class
v. File Streams
vi. RandomAccessFile

b. The NIO File API


i. FileSystem and Path
ii. NIO File Operations
c. The NIO Package

12
i. Asynchronous I/O
ii. Performance
iii. Mapped and Locked Files
iv. Channels
v. Buffers
vi. Character Encoders and Decoders
vii. FileChannel
d. Network Programming
e. Sockets

i. Clients and Servers


ii. The DateAtHost Client
iii. A Distributed Game

f. More to Explore
13. 12. Programming for the Web

a. Uniform Resource Locators


b. The URL Class
i. Stream Data
ii. Getting the Content as an Object
iii. Managing Connections
iv. Handlers in Practice
v. Useful Handler Frameworks

c. Talking to Web Applications

i. Using the GET Method


ii. Using the POST Method

13
iii. The HttpURLConnection
iv. SSL and Secure Web Communications
d. Java Web Applications

i. The Servlet Life Cycle


ii. Servlets
iii. The HelloClient Servlet
iv. The Servlet Response
v. Servlet Parameters
vi. The ShowParameters Servlet
vii. User Session Management
viii. The ShowSession Servlet

e. Servlet Containers

i. Configuration with web.xml and


Annotations
ii. URL Pattern Mappings
iii. Deploying HelloClient
f. The World Wide Web Is, Well, Wide

14. 13. Expanding Java

a. Java Releases
i. JCP and JSRs

b. Lambda Expressions

i. Retrofitting Your Code


c. Expanding Java Beyond the Core
d. Final Wrap-Up and Next Steps

14
15. A. Code Examples and IntelliJ IDEA

a. Grabbing the Main Code Examples


b. Installing IntelliJ IDEA

i. Installing on Linux
ii. Installing on a macOS
iii. Installing on Windows

c. Importing the Examples


d. Running the Examples
e. Grabbing the Web Code Examples
f. Working with Servlets
16. Glossary
17. Index

15
Learning Java
FIFTH EDITION

An Introduction to Real-World Programming with


Java

Marc Loy, Patrick Niemeyer, and Daniel Leuck

16
Learning Java

by Marc Loy, Patrick Niemeyer, and Daniel Leuck

Copyright © 2020 Marc Loy, Patrick Niemeyer, Daniel Leuck. All


rights reserved.

Printed in the United States of America.

Published by O’Reilly Media, Inc., 1005 Gravenstein Highway


North, Sebastopol, CA 95472.

O’Reilly books may be purchased for educational, business, or sales


promotional use. Online editions are also available for most titles
(http://oreilly.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
[email protected].

Acquisitions Editor: Suzanne McQuade

Developmental Editor: Amelia Blevins

Production Editor: Beth Kelly

Copyeditor: Sonia Saruba

Proofreader: Christina Edwards

Indexer: Angela Howard

Interior Designer: David Futato

Cover Designer: Karen Montgomery

17
Illustrator: Rebecca Demarest

May 2000: First Edition


July 2002: Second Edition
May 2005: Third Edition
June 2013: Fourth Edition
March 2020: Fifth Edition

Revision History for the Fifth Edition


2020-03-27: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781492056270 for


release details.

The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.


Learning Java, the cover image, and related trade dress are
trademarks of O’Reilly Media, Inc.

While the publisher and the authors have used good faith efforts to
ensure that the information and instructions contained in this work
are accurate, the publisher and the authors disclaim all responsibility
for errors or omissions, including without limitation responsibility
for damages resulting from the use of or reliance on this work. Use
of the information and instructions contained in this work is at your
own risk. If any code samples or other technology this work contains
or describes is subject to open source licenses or the intellectual
property rights of others, it is your responsibility to ensure that your
use thereof complies with such licenses and/or rights.

978-1-492-05627-0

[LSI]

18
Preface

This book is about the Java programming language and


environment. Whether you are a software developer or just someone
who uses the internet in your daily life, you’ve undoubtedly heard
about Java. Its introduction was one of the most exciting
developments in the history of the web, and Java applications have
powered much of the growth of business on the internet. Java is,
arguably, the most popular programming language in the world,
used by millions of developers on almost every kind of computer
imaginable. Java has surpassed languages such as C++ and Visual
Basic in terms of developer demand and has become the de facto
language for certain kinds of development—especially for web-
based services. Most universities are now using Java in their
introductory courses alongside the other important modern
languages. Perhaps you are using this text in one of your classes
right now!

This book gives you a thorough grounding in Java fundamentals and


APIs. Learning Java, Fifth Edition, attempts to live up to its name
by mapping out the Java language and its class libraries,
programming techniques, and idioms. We’ll dig deep into interesting
areas and at least scratch the surface of other popular topics. Other
titles from O’Reilly pick up where we leave off and provide more
comprehensive information on specific areas and applications of
Java.

Whenever possible, we provide compelling, realistic, and fun

19
examples and avoid merely cataloging features. The examples are
simple, but hint at what can be done. We won’t be developing the
next great “killer app” in these pages, but we hope to give you a
starting point for many hours of experimentation and inspired
tinkering that will lead you to develop one yourself.

Who Should Read This Book


This book is for computer professionals, students, technical people,
and Finnish hackers. It’s for everyone who has a need for hands-on
experience with the Java language with an eye toward building real
applications. This book could also be considered a crash course in
object-oriented programming, networking, and user interfaces. As
you learn about Java, you’ll also learn a powerful and practical
approach to software development, beginning with a deep
understanding of the fundamentals of Java and its APIs.

Superficially, Java looks like C or C++, so you’ll have a tiny


headstart in using this book if you have some experience with one of
these languages. If you do not, don’t worry. Don’t make too much of
the syntactic similarities between Java and C or C++. In many
respects, Java acts like more dynamic languages such as Smalltalk
and Lisp. Knowledge of another object-oriented programming
language should certainly help, although you may have to change
some ideas and unlearn a few habits. Java is considerably simpler
than languages such as C++ and Smalltalk. If you learn well from
concise examples and personal experimentation, we think you’ll like
this book.

The last part of this book branches out to discuss Java in the context
of web applications, web services, and request processing, so you

20
should be familiar with the basic ideas behind web browsers,
servers, and documents.

New Developments
This edition of Learning Java is actually the seventh edition—
updated and retitled—of our original, popular Exploring Java. With
each edition, we’ve taken great care not only to add new material
covering additional features, but to thoroughly revise and update the
existing content to synthesize the coverage and add years of real-
world perspective and experience to these pages.

One noticeable change in recent editions is that we’ve de-


emphasized the use of applets, reflecting their diminished role in
recent years in creating interactive web pages. In contrast, we’ve
greatly expanded our coverage of Java web applications and web
services, which are now mature technologies.

We cover all of the important features of the latest “long-term


support” release of Java, officially called Java Standard Edition (SE)
11, OpenJDK 11, but we also add in a few details from the “feature”
releases of Java 12, Java 13, and Java 14. Sun Microsystems (Java’s
keeper before Oracle) has changed the naming scheme many times
over the years. Sun coined the term Java 2 to cover the major new
features introduced in Java version 1.2 and dropped the term JDK in
favor of SDK. With the sixth release, Sun skipped from Java version
1.4 to Java 5.0, but reprieved the term JDK and kept its numbering
convention there. After that, we had Java 6, Java 7, and so on, and
now we are at Java 14.

This release of Java reflects a mature language with occasional

21
syntactic changes and updates to APIs and libraries. We’ve tried to
capture these new features and update every example in this book to
reflect not only the current Java practice, but style as well.

New in This Edition (Java 11, 12, 13, 14)


This edition of the book continues our tradition of rework to be as
complete and up-to-date as possible. It incorporates changes from
both the Java 11—again, the long-term support version—and Java
12, 13, and 14 feature releases. (More on the specifics of the Java
features included and excluded in recent releases in Chapter 13.)
New topics in this edition include:

New language features, including type inference in generics


and improved exception handling and automatic resource
management syntax
New interactive playground, jshell, for trying out code
snippets
The proposed switch expression
Basic lambda expressions
Updated examples and analysis throughout the book

Using This Book


This book is organized roughly as follows:

Chapters 1 and 2 provide a basic introduction to Java


concepts and a tutorial to give you a jump-start on Java
programming.
Chapter 3 discusses fundamental tools for developing with
Java (the compiler, the interpreter, jshell, and the JAR
file package).

22
Chapters 4 and 5 introduce programming fundamentals,
then describe the Java language itself, beginning with the
basic syntax and then covering classes and objects,
exceptions, arrays, enumerations, annotations, and much
more.
Chapter 6 covers exceptions, errors, and the logging
facilities native to Java.
Chapter 7 covers collections alongside generics and
parameterized types in Java.
Chapter 8 covers text processing, formatting, scanning,
string utilities, and much of the core API utilities.
Chapter 9 covers the language’s built-in thread facilities.
Chapter 10 covers the basics of graphical user interface
(GUI) development with Swing.
Chapter 11 covers Java I/O, streams, files, sockets,
networking, and the NIO package.
Chapter 12 covers web applications using servlets, servlet
filters, and WAR files, as well as web services.
Chapter 13 introduces the Java Community Process and
highlights how to track future changes to Java while
helping you retrofit existing code with new features, such as
the lambda expressions introduced in Java 8.

If you’re like us, you don’t read books from front to back. If you’re
really like us, you usually don’t read the preface at all. However, on
the off chance that you will see this in time, here are a few
suggestions:

If you are already a programmer and just need to learn Java


in the next five minutes, you are probably looking for the
examples. You might want to start by glancing at the
tutorial in Chapter 2. If that doesn’t float your boat, you

23
should at least look at the information in Chapter 3, which
explains how to use the compiler and interpreter. This
should get you started.
Chapters 11 and 12 are the places to head if you are
interested in writing network or web-based applications and
services. Networking remains one of the more interesting
and important parts of Java.
Chapter 10 discusses Java’s graphics features and
component architecture. You should read this if you are
interested in writing desktop graphical Java applications.
Chapter 13 discusses how to stay on top of changes to the
Java language itself, regardless of your particular focus.

Online Resources
There are many online sources for information about Java.

Oracle’s official website for Java topics is https://oreil.ly/Lo8QZ;


look here for the software, updates, and Java releases. This is where
you’ll find the reference implementation of the JDK, which includes
the compiler, the interpreter, and other tools.

Oracle also maintains the OpenJDK site. This is the primary open
source version of Java and the associated tools. We’ll be using the
OpenJDK for all the examples in this book.

You should also visit O’Reilly’s site at http://oreilly.com/. There


you’ll find information about other O’Reilly books for both Java and
a growing array of other topics. You should also check out the
online learning and conference options—O’Reilly is a real champion
for education in all its forms.

24
And of course, you can check the home page for Learning Java!

Conventions Used in This Book


The font conventions used in this book are quite simple.

Italic is used for:

Pathnames, filenames, and program names


Internet addresses, such as domain names and URLs
New terms where they are defined
Program names, compilers, interpreters, utilities, and
commands
Threads

Constant width is used for:

Anything that might appear in a Java program, including


method names, variable names, and class names
Tags that might appear in an HTML or XML document
Keywords, objects, and environment variables

Constant width bold is used for:

Text that is typed by the user on the command line or in a


dialog

Constant width italic is used for:

Replaceable items in code

In the main body of text, we always use a pair of empty parentheses


after a method name to distinguish methods from variables and other

25
creatures.

In the Java source listings, we follow the coding conventions most


frequently used in the Java community. Class names begin with
capital letters; variable and method names begin with lowercase. All
the letters in the names of constants are capitalized. We don’t use
underscores to separate words in a long name; following common
practice, we capitalize individual words (after the first) and run the
words together. For example: thisIsAVariable,
thisIsAMethod(), ThisIsAClass, and
THIS_IS_A_CONSTANT. Also, note that we differentiate between
static and nonstatic methods when we refer to them. Unlike some
books, we never write Foo.bar() to mean the bar() method of
Foo unless bar() is a static method (paralleling the Java syntax in
that case).

Using Code Examples


If you have a technical question or a problem using the code
examples, please send email to [email protected].

This book is here to help you get your job done. In general, if
example code is offered with this book, you may use it in your
programs and documentation. You do not need to contact us for
permission unless you’re reproducing a significant portion of the
code. For example, writing a program that uses several chunks of
code from this book does not require permission. Selling or
distributing examples from O’Reilly books does require permission.
Answering a question by citing this book and quoting example code
does not require permission. Incorporating a significant amount of
example code from this book into your product’s documentation

26
does require permission.

We appreciate, but generally do not require, attribution. An


attribution usually includes the title, author, publisher, and ISBN.
For example: “Learning Java, Fifth Edition, by Marc Loy, Patrick
Niemeyer, and Daniel Leuck (O’Reilly). Copyright 2020 Marc Loy,
Patrick Niemeyer, and Daniel Leuck, 978-1-492-05627-0.”

If you feel your use of code examples falls outside fair use or the
permission given above, feel free to contact us at
[email protected].

O’Reilly Online Learning

NOTE
For more than 40 years, O’Reilly Media has provided technology
and business training, knowledge, and insight to help companies
succeed.

Our unique network of experts and innovators share their knowledge


and expertise through books, articles, and our online learning
platform. O’Reilly’s online learning platform gives you on-demand
access to live training courses, in-depth learning paths, interactive
coding environments, and a vast collection of text and video from
O’Reilly and 200+ other publishers. For more information, please
visit http://oreilly.com.

How to Contact Us

27
Please address comments and questions concerning this book to the
publisher:

O’Reilly Media, Inc.

1005 Gravenstein Highway North

Sebastopol, CA 95472

800-998-9938 (in the United States or Canada)

707-829-0515 (international or local)

707-829-0104 (fax)

We have a web page for this book where we list errata and any
additional information. You can access this page at
https://oreil.ly/Java_5e.

The example code can be found separately on GitHub. There are two
repositories for this book: the main examples and the web examples.
More details on accessing and working the examples is provided in
Appendix A.

Email [email protected] to comment or ask technical


questions about this book.

For more information about our books, courses, and news, see our
website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

28
Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments
Many people have contributed to putting this book together, both in
its Exploring Java incarnation and in its current form as Learning
Java. Foremost, we would like to thank Tim O’Reilly for giving us
the opportunity to write this book. Thanks to Mike Loukides, the
series editor, whose patience and experience continue to guide us.
Other folks from O’Reilly, including Amelia Blevins, Zan
McQuade, Corbin Collins, and Jessica Haberman, have provided
consistent wisdom and encouragement. We could not have asked for
a more skillful or responsive team of people with whom to work.

The original version of the glossary came from David Flanagan’s


book Java in a Nutshell (O’Reilly). We also borrowed several class
hierarchy diagrams from David’s book. These diagrams were based
on similar diagrams by Charles L. Perkins.

Warm thanks to Ron Becker for sound advice and interesting ideas
as seen from the perspective of a layman well removed from the
programming world. Thanks also to James Elliott and Dan Leuck for
their excellent and timely feedback on the technical content of this
edition. As with so many things in the programming world, extra
eyes are indispensible, and we are lucky to have had such attentive
pairs in our corner.

29
Another Random Document on
Scribd Without Any Related Topics
Morison’s journal illustrates vividly how completely the military
authorities dominated the lives of the fort’s inhabitants. Not only
were the soldiers at the mercy of their officers, but civilians, such as
Morison’s nephew, William Morison, were helpless in the face of
military indifference to their problems since there was no civil
authority at Michilimackinac or anywhere else in what is now
Michigan to which they might appeal during this period. Traders
constantly complained at the high-handed actions of the fort’s
commanders who, these traders charged, used their position to gain
great material benefits for themselves and imposed ruinous
regulations on those traders who would not give them a cut of their
profits. The royal government sought to correct these abuses, but
throughout the period of British rule Michilimackinac is said to have
had a reputation as a center of corruption and misrule.

20
“Ensign Johnstone (who was there with his wife) saluted him with
innumberable knocks & kicks.”

21
Remarks December 1769.
[1stly.] That a few days after this unwarrantable Outrage perpetrated
against my dwelling House & person, John Chinn & Forrest Oaks
were so conscious of their Enormous guilt [and] struck with such a
Remorse, that they declared that they would upon their knees
publickly on the Parade beg to be pardoned if that would satisfy for
the Errors they were conscious of haveing committed. This they
expressed in the Audience of William Maxwell, Commissary, Sergt.
McMurray, George McBeath, [and] Henry Williams, traders.

2dly. That a certain gentleman heard it surmised among them that if


the above Submission would not take place, they might have another
Resolve which was to tamper with my Servant & advance him one
hundred pounds by way of bribe, as they looked on him as the most
Material witness in my intended process against them.

3rdly. Such is the depraved disposition of this profligate Garrison at


this Juncture (as well as now degenerateing into the most irregular
proceedings dayly) they had recourse to calumnious aspersions
contriveing to patch up false invective & ignominous Reports (as
under the Necessity of keeping my room, on account of the Severe
[bruises] I had sustained from such a rough handleing, that I wore
Boots with Creepers in my Room & [was] found lying down in my bed
with them); with this additional & abominable connivance that I kept
so long close in my Room to embrace one opportunity to drive away
Sorrow & get drunk privately. Such are the Diabolical dispositions of
many in this remote garrison who make a perpetual habit of
murdering time in excesses of Debauchery & most Licentious
practices. These false aspersions I had communicated to me by
George Main and Charles Morison, trader, the 10th December, 1769.

4thly. Upon the 11th do. Ens. Johnstone assumed to encroach upon
my Province by visiting Sergt. McPherson of the Colonel’s Company,
who says he never sent for him Directly or indirectly. He immediately
insisted upon seeing his wound, tho’ he was but newly dressed one
hour before, [and] took off the dressings, &c. After inspection 22
he told my patient for his comfort, it looked very bad, & that he
knew nothing better for him than to bathe it with brandy. [He] set off
directly, & left the tumefyed wound exposed to the Open air, till my
servant was obliged to go & dress him a second time. This among the
rest is one specimen of the Ens. Johnstone’s activity to interfere in
matters which did not concern him. That at the same time he told
Sergt. McPherson if he belonged to the Company, he [would give]
commands. He would immediately confine Dr. Morison in the common
guard house.

N. B.: That in a few days after this Violent Assault, John Chinn and
Forrest Oaks were observed conjointly & severally, loading their guns
& pistoles, which I dare say were intended for bad purposes which
they would in all appearance have prosecuted had not their
proceedings been disapproved of by a certain gentleman in the
Garrison.

One night the ensueing spring, when they carroused heartily at their
Bowl, John Chinn proposed to pay another Visit to the Doctor, which
being disapproved of by one of the principals in the Assault, was
dropped.

The 25th. December 1769. Ens. Johnstone with his irregular


associates, contrived among them, about day set in the evening, to
send a frenchman, who served Isaac Todd merchant, upon a false
Message to me two different times in great haste, acquainting me
that his master was very sick, & that he earnestly, in the most
pressing manner, demanded my immediate assistance. Upon which I
Repaired directly to wait upon Mr. Todd, & upon due enquiry, found
the Message to be a mere bubble, very like the triffling projectors,
Isaac Todd declareing himself well, & took it highly amiss that they
should take such libertys with his name, or give me such
Unnecessary trouble.

Some time in Summer 1770, Ens. Johnstone Knocked down a soldier


of the general’s Company, called Walker by name, in presence of the
Commanding officer, Capt. [George] Turnbull. The poor soldier 23
applyed to me, & told me he was afraid his cheek bone was
broke, which did not happen to be the case, tho’ it was prodigiously
swelled. Which cost me five or six days attendance and applications,
before he recovered so as to be fit for Duty.

Sunday evening at 11 O’clock, 2d. December 1770, a frenchman


knocked at the door of my house very hard, when I was abed.
Imagining it Might be from some sick soldier, [I] called to my servant
to open the Door, & there appeared a frenchman with a card in his
hand, charged with Mr. Chinn’s Compliments to Doctor Morison,
begging the favour of his Company to take a dance with them at
Christian Burge’s house. This I rejected with outmost derision &
Contempt, as I never did prostitute my judgement so low as to join
Company of any Denomination to break the Lord’s day in such a
publick [and] infamous manner; & indeed I looked upon the
Company so mean that I should be very scrupulous to join them even
on a Weekly day. I doubt not but Ens. Johnstone might be at the
head of such a Heathenish proposition as there is no irregularitys
committed here, wherein he is not either a prompter or a ready
Countenancer if not a perpetrator.

Sunday the 9th December 1770. Betwixt the hours of 11 & 12 o’Clock
forenoon, when the Garrison was at Church, Sergt. [Thomas] Carlile
of the general’s company had the guard that day, & being thirsty
stepped over to his own house (which was adjacent & directly
opposite to his guard) for a drink of spruce beer. He no sooner
opened the Door of his room than Ens. Johnstone (who was there
with his wife) saluted him with innumberable knocks & kicks till
(almost in his own words to me) he had knocked his head into
blubber, then kicked him in the private parts (from which Violence his
private parts, particularly one of his testicles, are greatly Swelled, of a
hue black as his Hat). [Johnson gave him] many bumps upon his
head, [and] his jaw bones, as he himself says, [are] so painful that
he can scarce open his mouth, but with great difficulty.

The poor Sergt. immediately returned to his guard & the next 24
day applyed to the commanding officer Capt. Turnbull of this
Fort for his Protection in regard to his most grievious situation, from
the Attrocious and barbarous usage he had sustained by the violent
proceedings of Ens. Johnstone whom he was determined to
prosecute to the outmost for the Violence done to his person, in his
own house.

N. B.: Ens. Johnstone confined two or three soldiers in the black-hole


for being absent from Divine service, where they were in durance
while he himself was pounding & kicking the poor Sergt. in this
barbarous manner.

Late in the evening Sunday above said, Ens. Johnstone was


swaggering away upon the Parade with a naked sword, or Dagger, in
his hand, & when it seems he could not meet a Humane [sic] Subject
to Use ill, he wrecked his Vengeance on a dog (belonging to one of
the Soldiers of the Garrison) by cutting him to the back-bone. The
poor brute made such a hideous noise, his wound being beyond
Remedy, [that] his master was obliged out of Pity to put him out of
pain by shooting him thro’ the head.

Wednesday 12th December 1770. A little before Roll-Call Ens.


Johnstone struck my servant, John Forbes, by giveing him several
blows, which hurt him prodigiously, for attempting to ridd some Dogs
that were a fighting & make[ing] a terrible Noise at the Door of my
house. He struck Sergt. McMurray, acting Sergt. Major in the fort,
with a severe blow, at the same time knocked down flat [on] the
ground Henry Adams of the Collonel’s Company, so that the dogs of
this garrison are so Usefull, Sergents & Soldiers must be knocked
down for attempting to hinder them from fighting & makeing a noise.

Ens. Johnstone kicked Sergt. McPherson of the Collonel’s Company in


presence of the Commanding officer, a little before he went down to
Detroit last fall. Wednesday 26th December 1770, upon the evening
of that day Ens. Johnstone knocked down Sergt. May upon the
Parade, by giveing him two severe blows on the neck & 25
Jawbones, after which he confined him, brought him to a tryal,
& sentenced [him] to be reduced to the ranks.
On Saturday 29th, Do., Ens. Johnstone wrangled with my nephew,
William Morison, erroneously & threatened to confine him in the
common guard-house.

Sunday evening 30th Do., Mrs. [George] McBeath invited me to walk


into her house. I was no sooner seated than she entered a grieveous
Complaint to me against Ens. Johnstone, affirming that he used
uncommon libertys with her Character, upon which she wrote him the
evening before a very spirited Letter of which she shewed me a Copy.
She actually pronounced him a very bad man. As a strong instance of
which, among many she could adduce, she declared he had
frequently tampered with her by many stratagems to destroy her
peace with her husband, which she looked upon as such a vile
insinuation she was determined never to admit of his Company for
the future.

Tuesday evening the 1st. Jan’y 1771. John Savage, Taylor & Soldier in
the general’s Company, twixt 11 & 12, had the Door of his house
forced open [and was] committed to the guard-house for not
suffering his wife to comply with obscene proposit[ions made] to her.
At this Exploit Ens. Johnstone was one of the chief witnesses. The
prisoner was set at liberty next morning without any crime given
against him.

Monday the 7th Jan’y 1771. Ens. Johnstone decoyed away Sergt.
Carlile’s wife, which he has been contriveing to accomplish many
months before this finishing stroake, & tho’ her husband was like to
break his Heart, and crying out his Eyes on the occasion, Yet no
Remonstrances would be payed the least attention to. Ens. Johnstone
quitted his Room in the officer’s barracks that evening which he
exchanged with Mr. Main for his. [He] sleeped with her that night in
his new room where he lives with her still, without dread or shame,
while the poor Husband is left in such a disconsolate situation that is
not easy to describe. He next morning (poor man) applyed to 26
the Commanding Officer, who gave him no satisfactory redress,
as he did not chuse to interfere either pro or con. Yet the next day
after her Elopement from her husband she had the honnour of dining
with the commanding officer and his mess, who drank tea with her
that evening at her new lodgeings.

Sergt. Carlile had the mortification to see his wife dayly conducted by
one of the mess to dine with the commanding officer, Capt. Turnbul,
& the good Company with him, at which the poor Sergt. was like to
go distracted but could not help himself.

Ens. Johnstone in the month [of December?] 1770, haveing crossed


on a party of pleasure in company with Capt. Turnbull & William
Maxwell, Commissary, flogged Knight, Soldier in the general’s
Company, with his own hand, without any regular tryal for his crime.
Proof: William Maxwell, Commissary, Rogers & McLean, soldiers.

As Ens. Johnstone thought proper to turn trader by selling of


common rum to the soldiers & all others by whom he might gain a
penny in this clandestine Manner, in the month of October 1767, he
was observed to have filled up several Barrels of common rum with
boiling water to make up the Leakage. Afterwards [he] sold this at
18. sh. York currency pr. gallon to Sergeants & Soldiers &c. in the
Garrison. Proof: Sergeants McMurray & Carlile with his own servant
Arthur Ross, who assisted him by his own self in the deceitfull
operation.

Upon friday the 8th febry. 1771, Ens. Johnstone in presence of the
Commanding officer, Capt. Turnbull, Ens. Strickland, George Main,
William Maxwell, Commissary, [and] George McBeath, trader,
attacked William Morison, my nephew, in a most rude and Violent
manner, without any evident cause, in the billiard Room in the
presence of six witnesses. The Young man (who is sometimes liable
to a fainting Disposition) in the Scuffle he fell down & cryed Murder!
William Maxwell, Commissary of provisions, interposed, by 27
which he received some knocks from Ens. Johnstone without
returning one blow, after which Johnstone passed by [the]
Commissary in a furious manner, & the young man was flat down in a
swoon. Ens. Johnstone raised up his left arm & gave him repeated
thumps opposite to the heart, by which it would appear he intended
to murder the young man.

He is now under care & it is a chance if ever he can get the better of
it. The commanding officer with all those of their Club was present to
all this. Some of them I am told stood firm with their backs to the
room door, I suppose to hinder any from comeing in to the assistance
of the ill-used Young man. At length the noise brought in Mr. Harise,
who can attest to everything he saw. Mr. Harise with one or two more
carryed him for dead to his room, where after untying his stock he
gradually recovered from his trance.

In the evening I went with my Nephew to wait on Capt. Turnbull to


enter a Complaint of his hard usage. After all the remonstrances he
could suggest, the Commanding Officer would give him no Redress,
tho’ he himself was personally present to the crime committed by
Johnstone. Upon which I myself made application to Capt. Turnbull in
the humblest manner to put Ens. Johnstone under arrest & that there
was no possibility of maintaining peace in the Garrison while
Johnstone was at liberty, nor could I think myself safe in the
Execution of my Office if my Remonstrances to him on that score did
not take place, which Capt. Turnbull Absolutely refused to do by
saying, with some warmth, he would not put Johnstone under arrest,
tho’ there [were] as many crimes against him as words on his
Commission.

The 23d. feby. 1771. Ens. Johnstone quarrelled with William Maxwell,
Commissary, & revilled [him] (if not gave him a few blows) with
exasperating expressions, both in company of the commanding
officer, who, when words became too high, ordered Ens. Johnstone
to his room, wherein he did not continue above twenty four hours,
for reasons best known to the Commanding Officer & himself.

28
“... a woman who I have the greatest regard for distracted me by her
imprudent behaviour.”

29
III
A Regimental Court-Martial

The little domestic tragedy involving Sergeant Thomas Carlile, his


wife, and Ensign Robert Johnson, the first two acts of which
transpired in the last chapter, now comes to an end with the utter
defeat and humiliation of the poor sergeant.

Brought to trial on a charge of being disrespectful to an officer, Carlile


sought to get his case tried not by a regimental court-martial, but by
a general court-martial which would have a larger number of judges,
including officers from other units, who would be more likely to judge
his case without prejudice. With Ensign Johnson sitting as a member
of the court it is not surprising that Carlile’s request was denied nor
that he was found guilty and reduced to the rank of private.
Carlile shortly was restored to his sergeant’s rating but only after
agreeing to take back his faithless wife and writing a letter at
Johnson’s order in which he abjectly begged forgiveness for daring to
suggest that the ensign ought not to sit as a member of the court.

The record of Carlile’s court-martial was stricken from the regimental


orderly book, but Morison copied the proceedings as follows:

Michilamackinac, February 16th, 1771. 30

Proceedings of a Regimental Court Martial, 2d. Battn. 60th Regt. by


order of Capt. Turnbull, Commandant.

President—Lieut. Christie

Prisoner, Sergt. Carlile

Ens. Johnstone, member

Confined by order of Ens. Strickland for being insolent & behaveing


with Disrespect to him. Ens. Strickland informs the Court that he
went a Carrioling [riding in a cariole, a kind of sleigh] with a
Woman under his Protection (namely Sergt. Carlile’s wife and Ens.
Johnstone’s whore) [and] that the prisoner came up and wished
that the Carriole, horse and all, might break in & go under the ice,
with other insolent Language.

The Prisoner being put to defence denys the crime & says he will
not be tryed by a Regimental Courtmartial, but desires a general
one, & objects to Ens. Johnstone, for reasons he now will not
mention. The Court is of oppinion the prisoner is guilty of the crime
laid to his Charge, therefore do sentence him to be reduced and
serve as private in the Ranks.

Signed/ Lieut. Christie, president

Approved, George Turnbull, Commandant.


Febry 1st. 1771. Ens. Johnstone by threats & promises prevailed
upon Sergt. Carlile, by frequent tamperings & Solicitations, to take his
wife back again. I imagine upon Examination of this accommodation
it will appear equally abominable as the original iniquitous &
intrigueing proceedings.

The 23d febry 1771. Ensigns Johnstone & Strickland haveing


requested of the commanding officer that Thomas Carlile, late Sergt.
in generall Armstrong’s Company, should be restored, he is therefore
restored to his former rank (after signing, I fancy, uncommon
preliminarys dictated to him by the Destroyer of his peace and 31
tranquility). He is to be obeyed as such. One infamous
restoration indeed when the terms are narrowly scrutinized.

N. B.: That upon the 26th febry. 1771. Capt. Turnbull, Commandant,
Issued verbal orders to Sergt. [Mc]Murray of the General’s Company
to Erase the proceedings of the Regimental Court Martial concerning
Sergt. Carlile’s tryal out of the Regimental Orderly book, & if he
could, would get it Erased out of the orderly book of the Lieut.
Colonel’s Company also. Accordingly Sergt. McGann of the Colonel’s
Company did erase it, without any previous notice given to the officer
who commanded the Company. As that officer was not a little
surprized at such uncommon proceedings, he immediately confined
him in the guard-house, who in his own defence told his officer he
received positive orders from the acting Sergt. Major so to do, who
had told him it was the orders of the day by the commanding officer,
Capt. Turnbull. Upon which the officer commanding the Coll’s
Company sent for the acting Sergt. Major who acknowledged to him
he had received orders from the Commanding officer of the Fort to
have the tryall of Sergt. Carlile torn out of the Book of both
Companies doing duty in Garrison. Upon which Declaration the officer
set Sergt. McGann at liberty.

Michilamackinac, 22d. febry 1771

Sir—
I hope You will pardon my takeing this Liberty to trouble You, but
to ease my own mind I cannot avoid it, by the instigation of my
own Notions. I was so imprudent to object to Ens. Johnstone’s
being a member of my Court Martial, altho’ I am now well
convinced that his own Honnour would not allow him to do
anything prejudicial to Justice. The only Excuse I can make to him
& Ens. Strickland is that a Woman who I have the greatest regard
for distracted me by her imprudent behaviour. This, Sir, I hope in
some part will Extenuate my Crimes, & I shall only further beg
leave to Observe that Ens. Johnstone has behaved to me as 32
a good officer, & I have no ground of Complaint against him,
& I am extreamely sorry for, & beg his forgiveness & Ens.
Strickland’s for my past behaveour, which I never will be guilty of
again.

I have the Honnour to be, Sir,

Your most Dutifull & humble Servant,

Signed—Tho’s Carlile, late Sergt.

To Capt. Turnbull
Commanding at Michilamackinac

The above is a coppy of a Letter directed to Capt. Turnbull by order


of Ens. Johnstone.

a true Copy

Signed/ Tho’s McMurray


acting Sergt. Major
Ft. Michilimackinac during the 1770’s

33
IV
A Catalogue of Foul Deeds

Dr. Morison now summarizes the evidence he had collected against


Ensign Johnson into a catalogue of his “exploits.” In addition to
proving that the ensign was a respecter of no one, regardless of age,
rank, sex, or position, the catalogue includes the intriguing report of
alleged intimacies between Johnson and Mrs. Robert Rogers. This
information may be true since we learn from another source that
Major Rogers was said to have been jealous of Johnson. The ironical
aspect of this whole matter is that ten years later when Elizabeth
Rogers sued for a divorce from the major one of her grounds for the
action was that her husband had been unfaithful to her while they
were at Michilimackinac.
Ensign Johnson finally met his match in the tough Connecticut trader,
Phineas Pond, and resigned his commission in November, 1771, and
disappeared from the scene.

Sentencing a soldier to receive a thousand lashes, which Morison also


relates in this chapter, was an unusually brutal penalty, although at
least one sentence of fifteen-hundred lashes of the “cat” is on record.
Ordinarily ten lashes was regarded as sufficient punishment for most
offenses and as many as thirty-nine lashes was considered cruel.

34
“... sentenced to Receive 1000 lashes for Desertion.”
Michilamackinack, 10th Aprile 1771. Ens. Johnstone
35

attempted a rape on a girl betwixt nine & ten Years of age. Her
shrieking out Violently alarmed her step-father, Arthur Ross, & others
in the barracks. This Arthur Ross was servant to Ens. Johnstone at
the time, who upon makeing remonstrances the next morning to Ens.
Johnstone of his rude & uncommon behaveour, Received a very
severe blow on the left breast from his master, Ens. Johnstone, which
made him quit his service instantly.

Ens. Johnstone acknowledged publickly, by way of Bravado, he had


carnal dealings with Mrs. Oldham (the mother of this girl upon whom
he attempted this Rape) three years agoe, and about twenty Days
agoe he vaunted of the same foul deed, declaring publickly it was [no
one’s business?]. This declaration happened two or three days before
he attempted the Rape upon her Young Daughter.

Tuesday the 23d Aprile 1771. We had a kind of horse race here; the
most of the garrison walked out to enjoy the pleasure of the Show.
Ens. Johnstone being appointed as one of the Judges upon the
Occasion, Ens. Strickland’s mare was saddled for him, that he might
be enabled to execute the important office with the more Alacrity.
The racers appeared on the ground expecting Ens. Johnstone with
outmost impatience. [They] sent several messages in quest of him;
his mare was found; but he himself could not, & no wonder for he
was then in a Captain’s Cabin marking barrells of Liquor to be Rolled
over to the Suttler’s house, which was observed to be conveyed in
this manner by Creditable Witnesses. Ens. Johnstone seized this
opportunity very seasonably while the racers waited half one hour for
his Judicial appearance before they could start.

After secureing his Cargoe in this manner he appeared soon after the
racers started. The horse won & the mare lost the race (which is a
surprizing Circumstance) according [to] the prevailing constitution of
this fort.
Thursday 25th. Aprile 1771. A Barrell of Liquor, at least 36
presumed to be, was Rolled over to the Suttler’s about 12
o’clock forenoon. This Barrell was marked Capt G. T. [George
Turnbull] & rolled over by Donaldson [?] of the General’s Company.

A Catalogue of Ens. Robert Johnstone of the


2d. Battl. Exploits.
1. Knocked down a frenchman at Grosse pointe.

2. Quarrelled with Mr. [Alexander] Baxter.

3. Quarrelled with Major [Robert] Rogers, & used uncommon


freedom with his wife, common fame says to the extent of carnal
conversation with her.

4th. Wounded Corpl. Johnstone of the general’s Company in the arm.

5thly. Attempted to draw his sword upon Mr. [Benjamin] Frobisher for
which he was put under arrest.

6thly. Quarrelled with & insulted Capt. [Frederick] Spiecmacher


[commandant, 1767-68], for which he was under arrest for five
months.

7thly. Selling of Common Rum to the Soldiers, mixing water with it, &
selling it afterwards at 18. sh. York Currency pr. Gallon.

8thly. Knockeing down Mr. Farrol, Barrack master, betwixt 70 & 80


Years of age, on board of the Gladwin.

9thly. Nonsuited at a prosecution in favours of a prostitute.

10thly. Committed Felony, attempted by him & two accomplices,


against the person of Doctor Morison.
11thly. Intended murder by Poison.

12thly. Mixing four ounces of Jallap with the water boiled for Punch at
a publick Enter[tain]ment.

13thly. Challenged Lieut. Christie, & asked him pardon without


coming to a tryal.

14thly. Sporting with Capt. [John] Browne & Capt. Glazier’s


Characters, calling the last a mean, low lived, Dirty fellow.

15thly. Flogged Knight, Soldier of the General’s Company, by his own


hand with a wooden Switch, in presence of Capt. Turnbull
without the benefit of a Court martial.

16thly. Kicked & Cuffed Sergeants & Soldiers upon the publick 37
Parade, to which the Commanding officer was present at
some of those Irregularitys.

17thly. Attempted to Murder William Morison, Nephew to Doctor


Morison, to which Capt. Turnbull, Commanding Officer, was
present, with many others.

18thly. Kicked and Cuffed Sergt. Carlile in his own house upon a
Sabbath day when the garrison was at Church, & in the Scuffle
hurt one of his stones.

19thly. Some days after that he decoyed away the Sergt’s wife, Mrs.
Carlile, who lived with him upwards of six weeks at Bed & board
&c.

20thly. Vaunted he had Carnal dealings with Mrs. Oldham & three
Years after attempted a Rape upon her daughter betwixt 9 & 10
years of age.

2lst. Was put under arrest by Capt. Turnbull for the space of 24 hours
for Quarrelling with Maxwell the Commissary.
22d. Attempted to sow Discord betwixt George McBeath and his wife
to whom he offered one hundred pounds &c provideing she
would take up with him & quit her husband.

23d. Sergt. Carlile of the General’s Company Objected to Ens.


Johnstone as a member of a Regimental Court Martial, set upon
his Accusation [to] which [he] pleaded not guilty, & for certain
Reasons desired the benefit of a general Court martial, which
was denyed him.

30th May 1771. That evening after Roll Call, a Delinquent, James
Coleman, soldier of the Lieut Colonel’s Company, sentenced to
Receive 1000 Lashes for Desertion, received near five hundred &
would have received more had not I intervened to hinder any more
proceedings as he was not able to endure any more.

That very evening of the 30th he was ordered by the Commanding


officer to the flogging post to receive the rest of his punishment,
without Consulting me whether he was fit to receive them or not. He
appeared under a file of men, in presence of the whole 38
garrison, to undergoe that which he was not able to support. At
that Juncture, he immediately fell upon his Knees & begged Capt.
Turnbull to delay the rest of his punishment till he was more fit to
undergoe them. Upon this application Capt. Turnbull asked my
oppinion. I answered he was not fit, & consequently he was under
the necessity of being carryed home to the Guard house by two
soldiers of the guard.

This lenity of mine in favours of the prisoner produced the following


Garrison orders (tho’ there was no previous complaint lodged):

Michilimackinac 31. May 1771. For the future the officer of the Day
will visit the men’s barracks every forenoon at 12 o’clock to see
that the Barracks are kept clean & that the sick or lame are
regularly visited by the Surgeon; when prisoners are in that
situation the Sergt. of the Guard will report to the officer of the day
if it should happen that they are not Regularly attended.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like