0% found this document useful (0 votes)
1 views

Java Programming Joyce Farrell download

The document provides information about the textbook 'Java Programming' by Joyce Farrell, including links for downloading the book and other related programming resources. It outlines the structure of the book, which covers various Java programming concepts and techniques across multiple chapters. Additionally, it includes copyright information and details on the electronic version of the textbook.

Uploaded by

cettahantzp1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Java Programming Joyce Farrell download

The document provides information about the textbook 'Java Programming' by Joyce Farrell, including links for downloading the book and other related programming resources. It outlines the structure of the book, which covers various Java programming concepts and techniques across multiple chapters. Additionally, it includes copyright information and details on the electronic version of the textbook.

Uploaded by

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

Java Programming Joyce Farrell pdf download

https://textbookfull.com/product/java-programming-joyce-farrell/

Download more ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

Java Programming Joyce Farrell

https://textbookfull.com/product/java-programming-joyce-
farrell-2/

Practical Numerical C Programming 1st Edition Philip


Joyce

https://textbookfull.com/product/practical-numerical-c-
programming-1st-edition-philip-joyce/

Programming in Java Sachin Malhotra

https://textbookfull.com/product/programming-in-java-sachin-
malhotra/

Murach s Java Programming Joel Murach

https://textbookfull.com/product/murach-s-java-programming-joel-
murach/
Practical Numerical C Programming: Finance,
Engineering, and Physics Applications Philip Joyce

https://textbookfull.com/product/practical-numerical-c-
programming-finance-engineering-and-physics-applications-philip-
joyce/

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/

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/

Java Network Programming Fourth Edition Harold Elliotte

https://textbookfull.com/product/java-network-programming-fourth-
edition-harold-elliotte/

Computer Graphics Programming in OpenGL with Java


Gordon

https://textbookfull.com/product/computer-graphics-programming-
in-opengl-with-java-gordon/
TM

JAVA PROGRAMMING

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
EIGHTH EDITION

TM

JAVA PROGRAMMING

JOYCE FARRELL

Australia • Brazil • Japan • Korea • Mexico • Singapore • Spain • United Kingdom • United States

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions, some third party content may be suppressed. Editorial
review has deemed that any suppressed content does not materially affect the overall learning experience. The publisher reserves the right to
remove content from this title at any time if subsequent rights restrictions require it. For valuable information on pricing, previous
editions, changes to current editions, and alternate formats, please visit www.cengage.com/highered to search by
ISBN#, author, title, or keyword for materials in your areas of interest.

Important Notice: Media content referenced within the product description or the product text may not be available in the eBook version.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Java Programming, © 2016, 2014, 2012 Cengage Learning
Eighth Edition WCN: 02-200-203
Joyce Farrell
ALL RIGHTS RESERVED. No part of this work covered by the copyright
Product Director: herein may be reproduced, transmitted, stored, or used in any form or
Kathleen McMahon by any means graphic, electronic, or mechanical, including but not
Senior Content Developer: limited to photocopying, recording, scanning, digitizing, taping, Web
Alyssa Pratt distribution, information networks, or information storage and
retrieval systems, except as permitted under Section 107 or 108 of the
Development Editor: Dan Seiter
1976 United States Copyright Act, without the prior written
Marketing Manager: Eric LaScola permission of the publisher.
Manufacturing Planner:
Julio Esperas
For product information and technology assistance, contact us at
Art Director: Jack Pendleton Cengage Learning Customer & Sales Support, 1-800-354-9706
Production Management,
For permission to use material from this text or product,
Copyediting, Composition,
Proofreading, and Indexing: submit all requests online at www.cengage.com/permissions.
Integra Software Services Pvt. Ltd. Further permissions questions can be emailed to
Cover Photo: permissionrequest@cengage.com.
©Maram/Shutterstock.com

Library of Congress Control Number: 2014956152


ISBN: 978-1-285-85691-9
Cengage Learning
20 Channel Center Street
Boston, MA 02210
USA

Cengage Learning is a leading provider of customized learning


solutions with office locations around the globe, including Singapore,
the United Kingdom, Australia, Mexico, Brazil, and Japan. Locate your
local office at www.cengage.com/global.

Cengage Learning products are represented in Canada by Nelson


Education, Ltd.

All images © 2016 Cengage Learning®. All rights reserved.


To learn more about Cengage Learning Solutions, visit
www.cengage.com.
Purchase any of our products at your local college store
or at our preferred online store www.cengagebrain.com.

Printed in the U nited States of America


Print N umber: 01 Print Year: 2015

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Brief Contents
v

Preface . . . . . . . . . . . . . . . . . . . . . . xxi
CHAPTER 1 Creating Java Programs . . . . . . . . . . . . . . . . 1
CHAPTER 2 Using Data . . . . . . . . . . . . . . . . . . . . . 53
CHAPTER 3 Using Methods, Classes, and Objects . . . . . . . 119
CHAPTER 4 More Object Concepts . . . . . . . . . . . . . . . 183
CHAPTER 5 Making Decisions . . . . . . . . . . . . . . . . . 245
CHAPTER 6 Looping . . . . . . . . . . . . . . . . . . . . . 301
CHAPTER 7 Characters, Strings, and the StringBuilder . . . 353
CHAPTER 8 Arrays . . . . . . . . . . . . . . . . . . . . . . 393
CHAPTER 9 Advanced Array Concepts . . . . . . . . . . . . . 439
CHAPTER 10 Introduction to Inheritance . . . . . . . . . . . . . 491
CHAPTER 11 Advanced Inheritance Concepts . . . . . . . . . . 537
CHAPTER 12 Exception Handling . . . . . . . . . . . . . . . . 593
CHAPTER 13 File Input and Output . . . . . . . . . . . . . . . 665
CHAPTER 14 Introduction to Swing Components . . . . . . . . 729
CHAPTER 15 Advanced GUI Topics . . . . . . . . . . . . . . . 791
CHAPTER 16 Graphics . . . . . . . . . . . . . . . . . . . . . 861
APPENDIX A Working with the Java Platform . . . . . . . . . . . 919
APPENDIX B Data Representation . . . . . . . . . . . . . . . 925
APPENDIX C Formatting Output . . . . . . . . . . . . . . . . 931
APPENDIX D Generating Random Numbers . . . . . . . . . . . 941
APPENDIX E Javadoc . . . . . . . . . . . . . . . . . . . . . 949
Glossary . . . . . . . . . . . . . . . . . . . . 957
Index . . . . . . . . . . . . . . . . . . . . . . 979

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Contents
vi

Preface . . . . . . . . . . . . . . . . . . xxi

CHAPT ER 1 Creating Java Programs . . . . . . . . . . . 1


Learning Programming Terminology . . . . . . . . . . . . . . 2
Comparing Procedural and Object-Oriented
Programming Concepts . . . . . . . . . . . . . . . . . . 6
Procedural Programming . . . . . . . . . . . . . . . . . . 6
Object-Oriented Programming . . . . . . . . . . . . . . . . 6
Understanding Classes, Objects, and Encapsulation . . . . . . 7
Understanding Inheritance and Polymorphism . . . . . . . . . 9
Features of the Java Programming Language . . . . . . . . . . 11
Java Program Types . . . . . . . . . . . . . . . . . . . . 12
Analyzing a Java Application that Produces Console Output . . . . 13
Understanding the Statement that Produces the Output . . . . . 14
Understanding the First Class . . . . . . . . . . . . . . . 15
Indent Style . . . . . . . . . . . . . . . . . . . . . . . 18
Understanding the main() Method . . . . . . . . . . . . . 19
Saving a Java Class . . . . . . . . . . . . . . . . . . . . 21
Compiling a Java Class and Correcting Syntax Errors . . . . . . . 23
Compiling a Java Class . . . . . . . . . . . . . . . . . . . 23
Correcting Syntax Errors . . . . . . . . . . . . . . . . . . 24
Running a Java Application and Correcting Logic Errors . . . . . . 29
Running a Java Application . . . . . . . . . . . . . . . . . 29
Modifying a Compiled Java Class . . . . . . . . . . . . . . 30
Correcting Logic Errors . . . . . . . . . . . . . . . . . . 31
Adding Comments to a Java Class . . . . . . . . . . . . . . . 32
Creating a Java Application that Produces GUI Output . . . . . . 35
Finding Help . . . . . . . . . . . . . . . . . . . . . . . . 38
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . . 39
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . 41

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Chapter Summary . . . . . . . . . . . . . . . . . . . . . . 45
Review Questions . . . . . . . . . . . . . . . . . . . . . . 46
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 48
Programming Exercises . . . . . . . . . . . . . . . . . . 48
Debugging Exercises . . . . . . . . . . . . . . . . . . . 50 vii
Game Zone . . . . . . . . . . . . . . . . . . . . . . . . 50
Case Problems . . . . . . . . . . . . . . . . . . . . . . 51

CHAPT ER 2 Using Data . . . . . . . . . . . . . . . . . 53


Declaring and Using Constants and Variables . . . . . . . . . . 54
Declaring Variables . . . . . . . . . . . . . . . . . . . . 55
Declaring Named Constants . . . . . . . . . . . . . . . . 56
The Scope of Variables and Constants . . . . . . . . . . . . 58
Concatenating Strings to Variables and Constants . . . . . . . 58
Pitfall: Forgetting that a Variable Holds
One Value at a Time . . . . . . . . . . . . . . . . . . . 60
Learning About Integer Data Types . . . . . . . . . . . . . . 64
Using the boolean Data Type . . . . . . . . . . . . . . . . . 70
Learning About Floating-Point Data Types . . . . . . . . . . . . 71
Using the char Data Type . . . . . . . . . . . . . . . . . . 72
Using the Scanner Class to Accept Keyboard Input . . . . . . . 78
Pitfall: Using nextLine() Following One of the
Other Scanner Input Methods . . . . . . . . . . . . . . 81
Using the JOptionPane Class to Accept GUI Input . . . . . . . 87
Using Input Dialog Boxes . . . . . . . . . . . . . . . . . . 87
Using Confirm Dialog Boxes . . . . . . . . . . . . . . . . 91
Performing Arithmetic . . . . . . . . . . . . . . . . . . . . 93
Associativity and Precedence . . . . . . . . . . . . . . . . 95
Writing Arithmetic Statements Efficiently . . . . . . . . . . . 96
Pitfall: Not Understanding Imprecision
in Floating-Point Numbers . . . . . . . . . . . . . . . . 96
Understanding Type Conversion . . . . . . . . . . . . . . . 101
Automatic Type Conversion . . . . . . . . . . . . . . . . 101
Explicit Type Conversions . . . . . . . . . . . . . . . . 102
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 106
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 107

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CONTENTS

Chapter Summary . . . . . . . . . . . . . . . . . . . . . 111


Review Questions . . . . . . . . . . . . . . . . . . . . . 111
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 114
Programming Exercises . . . . . . . . . . . . . . . . . 114
viii Debugging Exercises . . . . . . . . . . . . . . . . . . 116
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 117
Case Problems . . . . . . . . . . . . . . . . . . . . . 118

CHAPT ER 3 Using Methods, Classes, and Objects . . . . 119


Understanding Method Calls and Placement . . . . . . . . . . 120
Understanding Method Construction . . . . . . . . . . . . . 123
Access Specifiers . . . . . . . . . . . . . . . . . . . . 123
Return Type . . . . . . . . . . . . . . . . . . . . . . 124
Method Name . . . . . . . . . . . . . . . . . . . . . 125
Parentheses . . . . . . . . . . . . . . . . . . . . . . 125
Adding Parameters to Methods . . . . . . . . . . . . . . . 129
Creating a Method that Receives a Single Parameter . . . . . 130
Creating a Method that Requires Multiple Parameters . . . . . 133
Creating Methods that Return Values . . . . . . . . . . . . . 136
Chaining Method Calls . . . . . . . . . . . . . . . . . . 138
Learning About Classes and Objects . . . . . . . . . . . . . 142
Creating a Class . . . . . . . . . . . . . . . . . . . . . 145
Creating Instance Methods in a Class . . . . . . . . . . . . 147
Organizing Classes . . . . . . . . . . . . . . . . . . . 150
Declaring Objects and Using their Methods . . . . . . . . . . 154
Understanding Data Hiding . . . . . . . . . . . . . . . . 156
An Introduction to Using Constructors . . . . . . . . . . . . 159
Understanding that Classes Are Data Types . . . . . . . . . . 163
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 168
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 168
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 170
Review Questions . . . . . . . . . . . . . . . . . . . . . 171
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 174
Programming Exercises . . . . . . . . . . . . . . . . . 174
Debugging Exercises . . . . . . . . . . . . . . . . . . 177
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 178
Case Problems . . . . . . . . . . . . . . . . . . . . . 179

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CHAPT ER 4 More Object Concepts . . . . . . . . . . . 183
Understanding Blocks and Scope . . . . . . . . . . . . . . 184
Overloading a Method . . . . . . . . . . . . . . . . . . . 192
Automatic Type Promotion in Method Calls . . . . . . . . . 194
Learning About Ambiguity . . . . . . . . . . . . . . . . . 199 ix

Creating and Calling Constructors with Parameters . . . . . . . 200


Overloading Constructors . . . . . . . . . . . . . . . . 201
Learning About the this Reference . . . . . . . . . . . . . 205
Using the this Reference to Make Overloaded Constructors
More Efficient . . . . . . . . . . . . . . . . . . . . . 209
Using static Fields . . . . . . . . . . . . . . . . . . . 213
Using Constant Fields . . . . . . . . . . . . . . . . . . 215
Using Automatically Imported, Prewritten Constants
and Methods . . . . . . . . . . . . . . . . . . . . . . 220
The Math Class . . . . . . . . . . . . . . . . . . . . 221
Importing Classes that Are Not Imported Automatically . . . . 223
Using the LocalDate Class . . . . . . . . . . . . . . . 224
Understanding Composition and Nested Classes . . . . . . . . 230
Composition . . . . . . . . . . . . . . . . . . . . . . 230
Nested Classes . . . . . . . . . . . . . . . . . . . . . 232
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 234
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 234
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 236
Review Questions . . . . . . . . . . . . . . . . . . . . . 236
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 239
Programming Exercises . . . . . . . . . . . . . . . . . 239
Debugging Exercises . . . . . . . . . . . . . . . . . . 242
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 242
Case Problems . . . . . . . . . . . . . . . . . . . . . 243

CHAPT ER 5 Making Decisions . . . . . . . . . . . . . 245


Planning Decision-Making Logic . . . . . . . . . . . . . . . 246
The if and if…else Statements . . . . . . . . . . . . . . 248
The if Statement . . . . . . . . . . . . . . . . . . . . 248
Pitfall: Misplacing a Semicolon in an if Statement . . . . . . 249
Pitfall: Using the Assignment Operator Instead
of the Equivalency Operator . . . . . . . . . . . . . . 250

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CONTENTS

Pitfall: Attempting to Compare Objects


Using the Relational Operators . . . . . . . . . . . . . 251
The if…else Statement . . . . . . . . . . . . . . . . . 251
Using Multiple Statements in if and if…else Clauses . . . . 254
x Nesting if and if…else Statements . . . . . . . . . . . . 260
Using Logical AND and OR Operators . . . . . . . . . . . . 263
The AND Operator . . . . . . . . . . . . . . . . . . . . 263
The OR Operator . . . . . . . . . . . . . . . . . . . . 265
Short-Circuit Evaluation . . . . . . . . . . . . . . . . . . 266
Making Accurate and Efficient Decisions . . . . . . . . . . . 269
Making Accurate Range Checks . . . . . . . . . . . . . . 270
Making Efficient Range Checks . . . . . . . . . . . . . . 272
Using && and || Appropriately . . . . . . . . . . . . . . 273
Using the switch Statement . . . . . . . . . . . . . . . . 274
Using the Conditional and NOT Operators . . . . . . . . . . . 280
Using the NOT Operator . . . . . . . . . . . . . . . . . 281
Understanding Operator Precedence . . . . . . . . . . . . . 282
Adding Decisions and Constructors
to Instance Methods . . . . . . . . . . . . . . . . . . . 285
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 289
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 289
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 291
Review Questions . . . . . . . . . . . . . . . . . . . . . 291
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 294
Programming Exercises . . . . . . . . . . . . . . . . . 294
Debugging Exercises . . . . . . . . . . . . . . . . . . 297
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 297
Case Problems . . . . . . . . . . . . . . . . . . . . . 299

CHAPT ER 6 Looping . . . . . . . . . . . . . . . . . 301


Learning About the Loop Structure . . . . . . . . . . . . . . 302
Creating while Loops . . . . . . . . . . . . . . . . . . 303
Writing a Definite while Loop . . . . . . . . . . . . . . 303
Pitfall: Failing to Alter the Loop Control Variable
Within the Loop Body . . . . . . . . . . . . . . . . . 305
Pitfall: Unintentionally Creating a Loop with
an Empty Body . . . . . . . . . . . . . . . . . . . . 306

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Altering a Definite Loop’s Control Variable . . . . . . . . . . 307
Writing an Indefinite while Loop . . . . . . . . . . . . . 308
Validating Data . . . . . . . . . . . . . . . . . . . . . 310
Using Shortcut Arithmetic Operators . . . . . . . . . . . . . 314
Creating a for Loop . . . . . . . . . . . . . . . . . . . 319 xi
Unconventional for Loops . . . . . . . . . . . . . . . . 320
Learning How and When to Use a do…while Loop . . . . . . 325
Learning About Nested Loops . . . . . . . . . . . . . . . . 328
Improving Loop Performance . . . . . . . . . . . . . . . . 333
Avoiding Unnecessary Operations . . . . . . . . . . . . . 333
Considering the Order of Evaluation of Short-Circuit
Operators . . . . . . . . . . . . . . . . . . . . . . 334
Comparing to Zero . . . . . . . . . . . . . . . . . . . 334
Employing Loop Fusion . . . . . . . . . . . . . . . . . . 336
Using Prefix Incrementing Rather than Postfix
Incrementing . . . . . . . . . . . . . . . . . . . . . 337
A Final Note on Improving Loop Performance . . . . . . . . 338
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 342
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 342
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 344
Review Questions . . . . . . . . . . . . . . . . . . . . . 344
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 347
Programming Exercises . . . . . . . . . . . . . . . . . 347
Debugging Exercises . . . . . . . . . . . . . . . . . . 350
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 350
Case Problems . . . . . . . . . . . . . . . . . . . . . 352

CHAPT ER 7 Characters, Strings, and


the StringBuilder . . . . . . . . . . . . 353
Understanding String Data Problems . . . . . . . . . . . . . 354
Using Character Class Methods . . . . . . . . . . . . . . 355
Declaring and Comparing String Objects . . . . . . . . . . 359
Comparing String Values . . . . . . . . . . . . . . . . 359
Empty and null Strings . . . . . . . . . . . . . . . . . 363
Using Other String Methods . . . . . . . . . . . . . . . 365
Converting String Objects to Numbers . . . . . . . . . . 369

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CONTENTS

Learning About the StringBuilder


and StringBuffer Classes . . . . . . . . . . . . . . 374
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 381
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 382
xii Chapter Summary . . . . . . . . . . . . . . . . . . . . . 382
Review Questions . . . . . . . . . . . . . . . . . . . . . 383
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 385
Programming Exercises . . . . . . . . . . . . . . . . . 385
Debugging Exercises . . . . . . . . . . . . . . . . . . 388
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 388
Case Problems . . . . . . . . . . . . . . . . . . . . . 391

CHAPT ER 8 Arrays . . . . . . . . . . . . . . . . . . 393


Declaring Arrays . . . . . . . . . . . . . . . . . . . . . 394
Initializing an Array . . . . . . . . . . . . . . . . . . . . 399
Using Variable Subscripts with an Array . . . . . . . . . . . . 402
Using the Enhanced for Loop . . . . . . . . . . . . . . 403
Using Part of an Array . . . . . . . . . . . . . . . . . . 404
Declaring and Using Arrays of Objects . . . . . . . . . . . . 406
Using the Enhanced for Loop with Objects . . . . . . . . . 408
Manipulating Arrays of Strings . . . . . . . . . . . . . 408
Searching an Array and Using Parallel Arrays . . . . . . . . . 414
Using Parallel Arrays . . . . . . . . . . . . . . . . . . . 415
Searching an Array for a Range Match . . . . . . . . . . . 418
Passing Arrays to and Returning Arrays from Methods . . . . . 422
Returning an Array from a Method . . . . . . . . . . . . . 426
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 428
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 428
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 429
Review Questions . . . . . . . . . . . . . . . . . . . . . 430
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 433
Programming Exercises . . . . . . . . . . . . . . . . . 433
Debugging Exercises . . . . . . . . . . . . . . . . . . 435
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 435
Case Problems . . . . . . . . . . . . . . . . . . . . . 438

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CHAPT ER 9 Advanced Array Concepts . . . . . . . . . 439
Sorting Array Elements Using the Bubble Sort Algorithm . . . . 440
Using the Bubble Sort Algorithm . . . . . . . . . . . . . . 440
Improving Bubble Sort Efficiency . . . . . . . . . . . . . 442
Sorting Arrays of Objects . . . . . . . . . . . . . . . . . 443 xiii

Sorting Array Elements Using the Insertion Sort Algorithm . . . . 448


Using Two-Dimensional and Other Multidimensional Arrays . . . . 452
Passing a Two-Dimensional Array to a Method . . . . . . . . 454
Using the length Field with a Two-Dimensional Array . . . . 455
Understanding Ragged Arrays . . . . . . . . . . . . . . . 456
Using Other Multidimensional Arrays . . . . . . . . . . . . 456
Using the Arrays Class . . . . . . . . . . . . . . . . . . 459
Using the ArrayList Class . . . . . . . . . . . . . . . . 467
Creating Enumerations . . . . . . . . . . . . . . . . . . . 472
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 479
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 479
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 480
Review Questions . . . . . . . . . . . . . . . . . . . . . 481
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 484
Programming Exercises . . . . . . . . . . . . . . . . . 484
Debugging Exercises . . . . . . . . . . . . . . . . . . 486
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 487
Case Problems . . . . . . . . . . . . . . . . . . . . . 490

CHAPT ER 10 Introduction to Inheritance . . . . . . . . . 491


Learning About the Concept of Inheritance . . . . . . . . . . 492
Diagramming Inheritance Using the UML . . . . . . . . . . 492
Inheritance Terminology . . . . . . . . . . . . . . . . . 495
Extending Classes . . . . . . . . . . . . . . . . . . . . . 496
Overriding Superclass Methods . . . . . . . . . . . . . . . 502
Using the @Override Tag . . . . . . . . . . . . . . . . 504
Calling Constructors During Inheritance . . . . . . . . . . . . 507
Using Superclass Constructors that
Require Arguments . . . . . . . . . . . . . . . . . . 508
Accessing Superclass Methods . . . . . . . . . . . . . . . 513
Comparing this and super . . . . . . . . . . . . . . . 515
Employing Information Hiding . . . . . . . . . . . . . . . . 516

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CONTENTS

Methods You Cannot Override . . . . . . . . . . . . . . . . 518


A Subclass Cannot Override static Methods in
Its Superclass . . . . . . . . . . . . . . . . . . . . 518
A Subclass Cannot Override final Methods in
Its Superclass . . . . . . . . . . . . . . . . . . . . 522
xiv
A Subclass Cannot Override Methods
in a final Superclass . . . . . . . . . . . . . . . . 523
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 525
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 525
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 526
Review Questions . . . . . . . . . . . . . . . . . . . . . 527
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 530
Programming Exercises . . . . . . . . . . . . . . . . . 530
Debugging Exercises . . . . . . . . . . . . . . . . . . 533
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 534
Case Problems . . . . . . . . . . . . . . . . . . . . . 535

CHAPT ER 11 Advanced Inheritance Concepts . . . . . . . 537


Creating and Using Abstract Classes . . . . . . . . . . . . . 538
Using Dynamic Method Binding . . . . . . . . . . . . . . . 547
Using a Superclass as a Method Parameter Type . . . . . . 549
Creating Arrays of Subclass Objects . . . . . . . . . . . . . 551
Using the Object Class and Its Methods . . . . . . . . . . . 554
Using the toString() Method . . . . . . . . . . . . . 556
Using the equals() Method . . . . . . . . . . . . . . . 559
Using Inheritance to Achieve Good Software Design . . . . . . 564
Creating and Using Interfaces . . . . . . . . . . . . . . . . 565
Creating Interfaces to Store Related Constants . . . . . . . 570
Creating and Using Packages . . . . . . . . . . . . . . . . 574
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 580
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 580
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 581
Review Questions . . . . . . . . . . . . . . . . . . . . . 582
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 585
Programming Exercises . . . . . . . . . . . . . . . . . 585
Debugging Exercises . . . . . . . . . . . . . . . . . . 589
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 590
Case Problems . . . . . . . . . . . . . . . . . . . . . 590
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CHAPT ER 12 Exception Handling . . . . . . . . . . . . 593
Learning About Exceptions . . . . . . . . . . . . . . . . . 594
Trying Code and Catching Exceptions . . . . . . . . . . . . 599
Using a try Block to Make Programs “Foolproof” . . . . . . 604
Declaring and Initializing Variables in try…catch Blocks . . . 606 xv

Throwing and Catching Multiple Exceptions . . . . . . . . . . 609


Using the finally Block . . . . . . . . . . . . . . . . . 615
Understanding the Advantages of Exception Handling . . . . . . 618
Specifying the Exceptions that a Method Can Throw . . . . . . 621
Tracing Exceptions Through the Call Stack . . . . . . . . . . 626
Creating Your Own Exception Classes . . . . . . . . . . . 630
Using Assertions . . . . . . . . . . . . . . . . . . . . . 634
Displaying the Virtual Keyboard . . . . . . . . . . . . . . . 650
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 653
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 654
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 655
Review Questions . . . . . . . . . . . . . . . . . . . . . 656
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 659
Programming Exercises . . . . . . . . . . . . . . . . . 659
Debugging Exercises . . . . . . . . . . . . . . . . . . 662
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 662
Case Problems . . . . . . . . . . . . . . . . . . . . . 663

CHAPT ER 13 File Input and Output . . . . . . . . . . . . 665


Understanding Computer Files . . . . . . . . . . . . . . . 666
Using the Path and Files Classes . . . . . . . . . . . . . 667
Creating a Path . . . . . . . . . . . . . . . . . . . . . 668
Retrieving Information About a Path . . . . . . . . . . . . 669
Converting a Relative Path to an Absolute One . . . . . . . . 670
Checking File Accessibility . . . . . . . . . . . . . . . . 671
Deleting a Path . . . . . . . . . . . . . . . . . . . . . 673
Determining File Attributes . . . . . . . . . . . . . . . . 674
File Organization, Streams, and Buffers . . . . . . . . . . . . 678
Using Java’s IO Classes . . . . . . . . . . . . . . . . . . 680
Writing to a File . . . . . . . . . . . . . . . . . . . . . 683
Reading from a File . . . . . . . . . . . . . . . . . . . 685

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CONTENTS

Creating and Using Sequential Data Files . . . . . . . . . . . 687


Learning About Random Access Files . . . . . . . . . . . . 693
Writing Records to a Random Access Data File . . . . . . . . 697
Reading Records from a Random Access Data File . . . . . . . 704
xvi Accessing a Random Access File Sequentially . . . . . . . . 704
Accessing a Random Access File Randomly . . . . . . . . . 705
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 719
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 719
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 720
Review Questions . . . . . . . . . . . . . . . . . . . . . 721
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 724
Programming Exercises . . . . . . . . . . . . . . . . . 724
Debugging Exercises . . . . . . . . . . . . . . . . . . 726
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 727
Case Problems . . . . . . . . . . . . . . . . . . . . . 727

CHAPT ER 14 Introduction to Swing Components . . . . . 729


Understanding Swing Components . . . . . . . . . . . . . 730
Using the JFrame Class . . . . . . . . . . . . . . . . . . 731
Customizing a JFrame’s Appearance . . . . . . . . . . . 734
Using the JLabel Class . . . . . . . . . . . . . . . . . . 738
Changing a JLabel’s Font . . . . . . . . . . . . . . . . 740
Using a Layout Manager . . . . . . . . . . . . . . . . . . 743
Extending the JFrame Class . . . . . . . . . . . . . . . . 746
Adding JTextFields, JButtons, and Tool Tips to a
JFrame . . . . . . . . . . . . . . . . . . . . . . . . 748
Adding JTextFields . . . . . . . . . . . . . . . . . . 748
Adding JButtons . . . . . . . . . . . . . . . . . . . 750
Using Tool Tips . . . . . . . . . . . . . . . . . . . . . 752
Learning About Event-Driven Programming . . . . . . . . . . 755
Preparing Your Class to Accept Event Messages . . . . . . . 756
Telling Your Class to Expect Events to Happen . . . . . . . 757
Telling Your Class How to Respond to Events . . . . . . . . 757
An Event-Driven Program . . . . . . . . . . . . . . . . . 757
Using Multiple Event Sources . . . . . . . . . . . . . . . 759
Using the setEnabled() Method . . . . . . . . . . . . 761
Understanding Swing Event Listeners . . . . . . . . . . . . 764

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Using the JCheckBox, ButtonGroup, and JComboBox
Classes . . . . . . . . . . . . . . . . . . . . . . . . 767
The JCheckBox Class . . . . . . . . . . . . . . . . . 767
The ButtonGroup Class . . . . . . . . . . . . . . . . 771
The JComboBox Class . . . . . . . . . . . . . . . . . 772 xvii
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 780
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 780
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 781
Review Questions . . . . . . . . . . . . . . . . . . . . . 783
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 785
Programming Exercises . . . . . . . . . . . . . . . . . 785
Debugging Exercises . . . . . . . . . . . . . . . . . . 787
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 787
Case Problems . . . . . . . . . . . . . . . . . . . . . 788

CHAPT ER 15 Advanced GUI Topics . . . . . . . . . . . 791


Understanding the Content Pane . . . . . . . . . . . . . . 792
Using Color . . . . . . . . . . . . . . . . . . . . . . . 795
Learning More About Layout Managers . . . . . . . . . . . . 797
Using BorderLayout . . . . . . . . . . . . . . . . . 798
Using FlowLayout . . . . . . . . . . . . . . . . . . . 800
Using GridLayout . . . . . . . . . . . . . . . . . . . 802
Using CardLayout . . . . . . . . . . . . . . . . . . . 803
Using Advanced Layout Managers . . . . . . . . . . . . . 805
Using the JPanel Class . . . . . . . . . . . . . . . . . . 813
Creating JScrollPanes . . . . . . . . . . . . . . . . . 821
A Closer Look at Events and Event Handling . . . . . . . . . . 824
An Event-Handling Example: KeyListener . . . . . . . . 827
Using AWTEvent Class Methods . . . . . . . . . . . . . . 830
Understanding x- and y-Coordinates . . . . . . . . . . . . 832
Handling Mouse Events . . . . . . . . . . . . . . . . . . 832
Using Menus . . . . . . . . . . . . . . . . . . . . . . . 837
Using Specialized Menu Items . . . . . . . . . . . . . . . 841
Using addSeparator() . . . . . . . . . . . . . . . . 843
Using setMnemonic() . . . . . . . . . . . . . . . . . 843
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 848
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 849

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CONTENTS

Chapter Summary . . . . . . . . . . . . . . . . . . . . . 850


Review Questions . . . . . . . . . . . . . . . . . . . . . 851
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 853
Programming Exercises . . . . . . . . . . . . . . . . . 853
xviii Debugging Exercises . . . . . . . . . . . . . . . . . . 855
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 855
Case Problems . . . . . . . . . . . . . . . . . . . . . 859

CHAPT ER 16 Graphics . . . . . . . . . . . . . . . . . 861


Learning About Rendering Methods . . . . . . . . . . . . . 862
Drawing Strings . . . . . . . . . . . . . . . . . . . . . . 865
Repainting . . . . . . . . . . . . . . . . . . . . . . . 867
Setting a Font . . . . . . . . . . . . . . . . . . . . . 869
Using Color . . . . . . . . . . . . . . . . . . . . . . 870
Drawing Lines and Shapes . . . . . . . . . . . . . . . . . 874
Drawing Lines . . . . . . . . . . . . . . . . . . . . . 874
Drawing Unfilled and Filled Rectangles . . . . . . . . . . . 875
Drawing Clear Rectangles . . . . . . . . . . . . . . . . 875
Drawing Rounded Rectangles . . . . . . . . . . . . . . . 876
Drawing Shadowed Rectangles . . . . . . . . . . . . . . 878
Drawing Ovals . . . . . . . . . . . . . . . . . . . . . 879
Drawing Arcs . . . . . . . . . . . . . . . . . . . . . . 880
Creating Polygons . . . . . . . . . . . . . . . . . . . . 881
Copying an Area . . . . . . . . . . . . . . . . . . . . 883
Using the paint() Method with JFrames . . . . . . . . . 883
Learning More About Fonts . . . . . . . . . . . . . . . . . 891
Discovering Screen Statistics . . . . . . . . . . . . . . . 893
Discovering Font Statistics . . . . . . . . . . . . . . . . 894
Drawing with Java 2D Graphics . . . . . . . . . . . . . . . 898
Specifying the Rendering Attributes . . . . . . . . . . . . 899
Setting a Drawing Stroke . . . . . . . . . . . . . . . . . 901
Creating Objects to Draw . . . . . . . . . . . . . . . . . 902
Don’t Do It . . . . . . . . . . . . . . . . . . . . . . . . 910
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 911
Chapter Summary . . . . . . . . . . . . . . . . . . . . . 911
Review Questions . . . . . . . . . . . . . . . . . . . . . 912
Exercises . . . . . . . . . . . . . . . . . . . . . . . . 915

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Programming Exercises . . . . . . . . . . . . . . . . . 915
Debugging Exercises . . . . . . . . . . . . . . . . . . 916
Game Zone . . . . . . . . . . . . . . . . . . . . . . . 916
Case Problems . . . . . . . . . . . . . . . . . . . . . 918
xix
APPENDIX A Working with the Java Platform . . . . . . . 919
Learning about the Java SE Development Kit . . . . . . . . . 920
Configuring Windows to Use the JDK . . . . . . . . . . . . . 920
Finding the Command Prompt . . . . . . . . . . . . . . . 921
Command Prompt Anatomy . . . . . . . . . . . . . . . . 921
Changing Directories . . . . . . . . . . . . . . . . . . 921
Setting the class and classpath Variables . . . . . . . 922
Changing a File’s Name . . . . . . . . . . . . . . . . . 922
Compiling and Executing a Java Program . . . . . . . . . . . 923
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 923

APPENDIX B Data Representation . . . . . . . . . . . . 925


Understanding Numbering Systems . . . . . . . . . . . . . 926
Representing Numeric Values . . . . . . . . . . . . . . . . 927
Representing Character Values . . . . . . . . . . . . . . . 929
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 930

APPENDIX C Formatting Output . . . . . . . . . . . . . 931


Rounding Numbers . . . . . . . . . . . . . . . . . . . . 932
Using the printf() Method . . . . . . . . . . . . . . . . 933
Specifying a Number of Decimal Places to
Display with printf() . . . . . . . . . . . . . . . . 936
Specifying a Field Size with printf() . . . . . . . . . . . 937
Using the Optional Argument Index with printf() . . . . . 938
Using the DecimalFormat Class . . . . . . . . . . . . . 939
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 940

APPENDIX D Generating Random Numbers . . . . . . . . 941


Understanding Computer-Generated Random Numbers . . . . . 942
Using the Math.random() Method . . . . . . . . . . . . . 943
Using the Random Class . . . . . . . . . . . . . . . . . . 944
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 947

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
CONTENTS

APPENDIX E Javadoc . . . . . . . . . . . . . . . . . 949


The Javadoc Documentation Generator . . . . . . . . . . . . 950
Javadoc Comment Types . . . . . . . . . . . . . . . . . . 950
Generating Javadoc Documentation . . . . . . . . . . . . . 952
xx Specifying Visibility of Javadoc Documentation . . . . . . . . 955
Key Terms . . . . . . . . . . . . . . . . . . . . . . . . 956

Glossary . . . . . . . . . . . . . . . . . 957
Index . . . . . . . . . . . . . . . . . . . 979

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Preface
xxi

Java Programming, Eighth Edition, provides the beginning programmer with a guide to
developing applications using the Java programming language. Java is popular among
professional programmers because it can be used to build visually interesting graphical user
interface (GUI) and Web-based applications. Java also provides an excellent environment for
the beginning programmer—a student can quickly build useful programs while learning the
basics of structured and object-oriented programming techniques.
This textbook assumes that you have little or no programming experience. It provides a solid
background in good object-oriented programming techniques and introduces terminology
using clear, familiar language. The programming examples are business examples; they do not
assume a mathematical background beyond high-school business math. In addition, the
examples illustrate only one or two major points; they do not contain so many features that
you become lost following irrelevant and extraneous details. Complete, working programs
appear frequently in each chapter; these examples help students make the transition from the
theoretical to the practical. The code presented in each chapter can also be downloaded from
the publisher’s Web site, so students can easily run the programs and experiment with
changes to them.
The student using Java Programming, Eighth Edition, builds applications from the bottom up
rather than starting with existing objects. This facilitates a deeper understanding of the
concepts used in object-oriented programming and engenders appreciation for the existing
objects students use as their knowledge of the language advances. When students complete
this book, they will know how to modify and create simple Java programs, and they will have
the tools to create more complex examples. They also will have a fundamental knowledge of
object-oriented programming, which will serve them well in advanced Java courses or in
studying other object-oriented languages such as C++, C#, and Visual Basic.

Organization and Coverage


Java Programming, Eighth Edition, presents Java programming concepts, enforcing good
style, logical thinking, and the object-oriented paradigm. Objects are covered right from the
beginning, earlier than in many other textbooks. You create your first Java program in
Chapter 1. Chapters 2, 3, and 4 increase your understanding of how data, classes, objects,
and methods interact in an object-oriented environment.
Chapters 5 and 6 explore input and repetition structures, which are the backbone of
programming logic and essential to creating useful programs in any language. You learn the
special considerations of string and array manipulation in Chapters 7, 8, and 9.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
PREFACE Features

Chapters 10, 11, and 12 thoroughly cover inheritance and exception handling. Inheritance is
the object-oriented concept that allows you to develop new objects quickly by adapting the
features of existing objects; exception handling is the object-oriented approach to handling
errors. Both are important concepts in object-oriented design. Chapter 13 provides
information on handling files so you can permanently store and retrieve program output.
xxii
Chapters 14, 15, and 16 introduce GUI Swing components (Java’s visually pleasing,
user-friendly widgets), their layout managers, and graphics.

Features
The following features are new for the Eighth Edition:
JAVA 8E: All programs have been tested using Java 8e, the newest edition of Java.
WINDOWS 8.1: All programs have been tested in Windows 8.1, and all screen shots have
been taken in this new environment.
DATE AND TIME CLASSES: This edition provides thorough coverage of the java.time
package, which is new in Java 8e.
ON-SCREEN KEYBOARD: This edition provides instructions for displaying and using an
on-screen keyboard with either a touch screen or a standard screen.
MODERNIZED GRAPHICS OUTPUT: The chapter on graphics (Chapter 16) has been
completely rewritten to focus on Swing component graphics production using the
paintComponent() method.

MODERNIZED OVERRIDING: The @Override tag is introduced.


EXPANDED COVERAGE OF THE EQUALS() METHOD: The book provides a thorough
explanation of the difference between overloading and overriding the equals() method.
PROGRAMMING EXERCISES: Each chapter contains several new programming exercises
not seen in previous editions. All exercises and their solutions from the previous edition
that were replaced in this edition are still available in the Instructor’s Resource Kit.
Additionally, Java Programming, Eighth Edition, includes the following features:
OBJECTIVES: Each chapter begins with a list of objectives so you know the topics that will
be presented in the chapter. In addition to providing a quick reference to topics covered,
this feature provides a useful study aid.
YOU DO IT: In each chapter, step-by-step exercises help students create multiple working
programs that emphasize the logic a programmer uses in choosing statements to include.
These sections provide a means for students to achieve success on their own—even those
in online or distance learning classes.
NOTES: These highlighted tips provide additional information—for example, an
alternative method of performing a procedure, another term for a concept, background
information on a technique, or a common error to avoid.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Features

EMPHASIS ON STUDENT RESEARCH: The student frequently is directed to the Java Web
site to investigate classes and methods. Computer languages evolve, and programming
professionals must understand how to find the latest language improvements. This book
encourages independent research.
FIGURES: Each chapter contains many figures. Code figures are most frequently 25 lines
xxiii
or fewer, illustrating one concept at a time. Frequent screen shots show exactly how
program output appears. Callouts appear where needed to emphasize a point.
COLOR: The code figures in each chapter contain all Java keywords in blue. This helps
students identify keywords more easily, distinguishing them from programmer-selected
names.
FILES: More than 200 student files can be downloaded from the publisher’s Web site. Most
files contain the code presented in the figures in each chapter; students can run the code for
themselves, view the output, and make changes to the code to observe the effects. Other
files include debugging exercises that help students improve their programming skills.
TWO TRUTHS & A LIE: A short quiz reviews each chapter section, with answers provided.
This quiz contains three statements based on the preceding section of text—two
statements are true and one is false. Over the years, students have requested answers to
problems, but we have hesitated to distribute them in case instructors want to use
problems as assignments or test questions. These true–false quizzes provide students with
immediate feedback as they read, without “giving away” answers to the multiple-choice
questions and programming exercises.
DON’T DO IT: This section at the end of each chapter summarizes common mistakes and
pitfalls that plague new programmers while learning the current topic.
KEY TERMS: Each chapter includes a list of newly introduced vocabulary, shown in the
order of appearance in the text. The list of key terms provides a short review of the major
concepts in the chapter.
SUMMARIES: Following each chapter is a summary that recaps the programming
concepts and techniques covered in the chapter. This feature provides a concise means for
students to check their understanding of the main points in each chapter.
REVIEW QUESTIONS: Each chapter includes 20 multiple-choice questions that serve as a
review of chapter topics.
GAME ZONE: Each chapter provides one or more exercises in which students can create
interactive games using the programming techniques learned up to that point; 70 game
programs are suggested in the book. The games are fun to create and play; writing them
motivates students to master the necessary programming techniques. Students might
exchange completed game programs with each other, suggesting improvements and
discovering alternate ways to accomplish tasks.
CASES: Each chapter contains two running case problems. These cases represent projects
that continue to grow throughout a semester using concepts learned in each new chapter.
Two cases allow instructors to assign different cases in alternate semesters or to divide
students in a class into two case teams.
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
PREFACE Instructor Resources

GLOSSARY: This edition contains an alphabetized list of all key terms identified in the
book, along with their definitions.
APPENDICES: This edition includes useful appendices on working with the Java platform,
data representation, formatting output, generating random numbers, and creating Javadoc
comments.
xxiv
QUALITY: Every program example, exercise, and game solution was tested by the author
and then tested again by a quality assurance team using Java Standard Edition (SE) 8, the
most recent version available.

CourseMate
The more you study, the better the results. Make the most of your study time by accessing
everything you need to succeed in one place. Read your textbook, take notes, review
flashcards, watch videos, and take practice quizzes online. CourseMate goes beyond the book
to deliver what you need! Learn more at www.cengage.com/coursemate.
The Java Programming CourseMate includes:
Debugging Exercises: Four error-filled programs accompany each chapter. By
debugging these programs, students can gain expertise in program logic in general and
the Java programming language in particular.
Video Lessons: Each chapter is accompanied by at least three video lessons that help to
explain important chapter concepts. These videos were created and narrated by the
author.
Interactive Study Aids: An interactive eBook, quizzes, flashcards, and more!
Instructors may add CourseMate to the textbook package, or students may purchase
CourseMate directly at www.CengageBrain.com.

Instructor Resources
The following teaching tools are available for download at our Instructor Companion Site.
Simply search for this text at sso.cengage.com. An instructor login is required.
Electronic Instructor’s Manual: The Instructor’s Manual that accompanies this
textbook contains additional instructional material to assist in class preparation,
including items such as Overviews, Chapter Objectives, Teaching Tips, Quick
Quizzes, Class Discussion Topics, Additional Projects, Additional Resources, and Key
Terms. A sample syllabus is also available. Additional exercises in the Instructor’s
Manual include:
Tough Questions: Two or more fairly difficult questions that an applicant
might encounter in a technical job interview accompany each chapter. These
questions are often open-ended; some involve coding and others might involve
research.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Acknowledgments

Up for Discussion: A few thought-provoking questions concerning programming in


general or Java in particular supplement each chapter. The questions can be used to
start classroom or online discussions, or to develop and encourage research, writing,
and language skills.
Programming Exercises and Solutions: Each chapter is accompanied by several
xxv
programming exercises to supplement those offered in the text. Instructors can use
these exercises as additional or alternate assignments, or as the basis for lectures.
Test Bank: Cengage Learning Testing Powered by Cognero is a flexible, online system
that allows you to:
Author, edit, and manage test bank content from multiple Cengage Learning
solutions.
Create multiple test versions in an instant.
Deliver tests from your LMS, your classroom, or anywhere you want.
PowerPoint Presentations: This text provides PowerPoint slides to accompany each
chapter. Slides may be used to guide classroom presentations, to make available to
students for chapter review, or to print as classroom handouts. Files are provided for every
figure in the text. Instructors may use the files to customize PowerPoint slides, illustrate
quizzes, or create handouts.
Solutions: Solutions to “You Do It” exercises and all end-of-chapter exercises are
available. Annotated solutions are provided for some of the multiple-choice Review
Questions. For example, if students are likely to debate answer choices or not understand
the choice deemed to be the correct one, a rationale is provided.

Acknowledgments
I would like to thank all of the people who helped to make this book a reality, including Dan
Seiter, Development Editor; Alyssa Pratt, Senior Content Developer; Carmel Isaac, Content
Project Manager; and Chris Scriver and Danielle Shaw, quality assurance testers. I am lucky to
work with these professionals who are dedicated to producing high-quality instructional
materials.
I am also grateful to the reviewers who provided comments and encouragement during this
book’s development, including Bernice Cunningham, Wayne County Community College
District; Bev Eckel, Iowa Western Community College; John Russo, Wentworth Institute of
Technology; Leslie Spivey, Edison Community College; and Angeline Surber, Mesa
Community College.
Thanks, too, to my husband, Geoff, for his constant support and encouragement. Finally, this
book is dedicated to the newest Farrell, coming March 2015. As this book goes to production,
I don’t know your name or even your gender, but I do know that I love you.
Joyce Farrell

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Read This Before
xxvi
You Begin
The following information will help you as you prepare to use this textbook.

To the User of the Data Files


To complete the steps and projects in this book, you need data files that have been created
specifically for this book. Your instructor will provide the data files to you. You also can
obtain the files electronically from www.CengageBrain.com. Find the ISBN of your title on the
back cover of your book, then enter the ISBN in the search box at the top of the Cengage
Brain home page. You can find the data files on the product page that opens. Note that
you can use a computer in your school lab or your own computer to complete the exercises
in this book.

Using Your Own Computer


To use your own computer to complete the steps and exercises, you need the following:
Software: Java SE 8, available from www.oracle.com/technetwork/java/index.html. Although
almost all of the examples in this book will work with earlier versions of Java, this book was
created using Java 8. The book clearly points out the few cases when an example is based on
Java 7 and will not work with earlier versions of Java. You also need a text editor, such as
Notepad. A few exercises ask you to use a browser for research.
Hardware: If you are using Windows 8, the Java Web site suggests at least 128 MB of
memory and at least 181 MB of disk space. For other operating system requirements, see
http://java.com/en/download/help.

Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Features
This text focuses on helping students become better programmers and understand
Java program development through a variety of key features. In addition to Chapter
Objectives, Summaries, and Key Terms, these useful features will help students
regardless of their learning styles. xxvii

YOU DO IT sections walk


students through program
development step by step.

NOTES provide
additional information—
for example, another
location in the book that
expands on a topic, or a
common error to watch
out for.

The author does an awesome


job: the examples, problems,
VIDEO LESSONS help
and material are very easy to
explain important chapter
understand!
concepts. Videos are part
—Bernice Cunningham, of the text’s enhanced
Wayne County Community
CourseMate site.
College District
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Random documents with unrelated
content Scribd suggests to you:
Company B.—Killed, Lieut. F. E. Vogler, Sergt. John Schmidt, Privates
Edward Dettmar, Albert Kineoke, Conrad Maul, John Mesh, Frank
Scheffer and Henry Weber. In all, 8 killed. Wounded, Sergt. John
Mallmann, Privates Lorenz Ackermann, Joseph Ammon, Mathias
Arnold, Jacob Bauer, Morand Barrmann, George Betz, Gustar Blank,
Joss. Cropp, Albert Donner, Frederick Entz, Amald Gerig, Charles
Grin, Conrad Hellmuth, Gerhard Janssen, Valentin Kadel, August
Lopold, Louis Linne, Paul Martin, Ignaz Menne, Sabastian Pfister,
John Raffel, Peter Reppel, George Salz, Henry Schmidt, Jacob Spiess,
Philipp Spiess, Corp. Hermann Suemnicht, Jacob Sulzer, Daniel
Werner, Christ. Wickermann, Ferdinand Wisshack, Corp. Augustus
Wurmb. In all, 33 wounded.
Company C.—Killed, Wm. Klingenberg, John Lamprecht, George
Lehr, Michael Lehr, Friedrich Lippert, Geo. Luther, Henry Riditer,
Sergt. Chas. Hahle, Christian Schenk, Wm. Slorch and August
Wichard. In all, 11 killed. Wounded, First Lieut. Oscar Rollmann, A.
Arramus, Anton Becker, Henry Behm, Andrew Benci, Philipp Erbe,
Chas. Friedrich, Wm. Gaebe, Jacob Haberkorn, John A. Helferich,
Frank Helferich, Jacob Herpin, Christian Keith, Christian Macdel,
Frank Moser, Andrew Nadber, Jacob Randall, Antoo Saebert, Charles
Schenk, Fred. Scheve, Henry Schemph, Peter Schneider, Nicklaus
Schouelber, John Spaule, John Salzmann, Freiderich Slaab, Henry
Vishsel. In all, 27 wounded.
Company D.—Killed, Jacob Becker, Charles Geesel, Henry Geesel,
Adam Loebig, Christian Kahn, Adam Kertz, Jacob Kieps, Philip Laner,
Albert Scheleberg, Schelz Tert, Wm. Vogelpohl and Henry Vohs. In
all, 12 killed. Wounded, Capt. Beckier, Lieuts. Krebs and Scheal, John
Baehr, Herman Bange, Isiter Bayett, Joseph Beck, Rudolph Bekier,
Wm. Beeverson, Jos. Ersenhauer, Anlon Garllhoeffner, Fred.
Havermann, Conrath Heidmann, Chas. Huber, Edward Krebs, William
Lieser, Chas. Miller, George Metzker, C. Moeninger, C. Roth Roffy,
Fried. Scheel, Os. Stocker, Bernhard Vogel, and Tweibert Henry. In
all, 34 wounded.
Company E.—Killed, Sergt. Silas Bunker, Privates John Anson, Frank
M. Moore, Wm. D. Nevius, James McKenzie, John C. Cadie. In all, 6
killed. Wounded, Corps. Jas. G. Carnahan, Joseph R. Cox, and Philip
Anderson, Privates Jas. M. Blake, Matthew Bromley, Geo. H.
Campbell, Chas. Dryden, Michael Furlong, Daniel Hubbard, John W.
Hay, Jos. B. Jones, Jas. Mahone, Geo. Meyer, Francis J. Murphy,
Jesse Mack, John N. Shoemaker, Thos. Stalkal, Neal Vestal, Sergt.
Lewis C. Bornman, Musician Samuel Williams, Wagoner Wm. Minor,
Wm. Mock. In all, 22 wounded.
Company F.—Killed, Sergt. And. J. Webster, Corps. Joshua Gear and
Frank Pothast, Privates Demean McCulloch, John Chantick, Toliver
Foster, Thos. Cox, Joseph Koontz, Geo. McLeish, Charles Hills, John
W. Snofpr, Private of the 71st Ohio, name not known. In all, 13
killed. Wounded, Capt. Webb, Lieut. Geo. Williford, Sergts. Jos. C.
Gales and R. N. Heinberger, Corp. And. J. White, Privates John B.
Choenewith, Jas. Rodgers, James Duncan, N. B. Winters, John
McCarter, John Stutfouth, John H. Lauchly, James Getty, Jos. L.
Miller, James Hobbs, Wm. T. Miller, John H. Collins, M. N. Fisher,
Harlow Bassett, Jas. M. Hickman, And. Grudin, Henry Grundin, R.
Pimpkins, Geo. W. Warren, John M. Ticknor, Marcus Burns. In all, 26
wounded.
Company G.—Killed, David Jones, Alpheus Bascum, Jas. Walker,
Thos. J. Ouly and Wm. H. Bascom. In all, 5 killed. Wounded, Lieut.
Clemens, N. G. Poraine, John B. Russell, E. B. Rhoads, Wm.
Hampton, John J. White, (afterwards died,) John W. Brown, Wm. L.
Brown, N. G. Brown, Henry Brown, John J. Zippy, John J. Stripling,
Wm. R. Bradley, Wm. Addison, Lewis R. Applegate Robert Marshall,
Daniel Ryan, Thos. Stotlar, A. B. Suttin, W. S. White, John McCord,
Lewis Wise, Jun., Allen Edwards, S. P. Hartsell, Charles W. Miller,
Bennet Strotlar. In all, 26 wounded.
Company H.—Killed, Sergt. Francis D. Hubbel, Will. R. Haller, Daniel
C White, Thos. Wright. In all, 4 killed. Wounded, Captain W. F.
Armstrong, Sergts. Daniel Pentzer and Jacob Miller, Privates
Nickolaus Keller, Alonzo F. McEwen, Paul Roberts, Jas. W. Osborn,
Sidney B. Phillips, John Arny, Wm. Boldeman, Dennis Bahon, Chas.
Biernbrier, Wm. S. Cheeney, Wm. A. Cottingham, Ira G. Dart, John
Droesch, Thos. Fry, Will. H. Ilsley, Wm. Keep, John B. Livingood,
John F. Moore, Patrick Mogneham, Layfayette Mason, Jas. S.
McGuillion, Edward Nail, George Ralph, Francis M. Stickel, Almon D.
Simmons, Jos. E. Taulber, Moses H. Turner, Patrick Whalen, Erasmus
Gaw, Jas. A. Clotpelter, George H. Dry, John Salzmann, and Daniel C.
Carriker. In all, 36 wounded.
Company I.—Killed, Nathan Abbot, John Bass, Reegon Edward, John
N. Larance and Frederick Swartz. In all, 5 killed. Wounded, Captain
Jos. G. Robinson, 1st Lieutenant Wm. H. Purviance, Sergt. W. W.
Jarvis, Corp. G. W. Stice, Privates John Baird, Norman Barber, Isaiah
Bery, G. W. Clark, Thomas C Gillham, Wm. Helms, Thomas Hauskins,
John Jaka, S. B. Jarvis, Chas. C. Lewis, Albert Mills, Geo. McKinley,
Chas. A. Redman, John Wilson and Henry Wormyer. In all, 19
wounded.
Company K.—Killed, George Sloan, Wm. Foster, Jas. L. Kriddler,
Thos. Walton. In all, 4 killed. Wounded, John Richmond, Samuel W.
Sloan, Geo. W. Burton, Sen., Geo. W. Burton, Jun., John Burke, Chas.
W. Boles, Henderson Cogdall, John L. Creed, John Clifford, Wm. A.
Carding, Frank F. Cogles, John Horn, Thos. J. Hagler, Laro May, Sam'l
L. Miller, Robert E. Ramsey, Jonathan Stone, and Chas. L. Tomlinson.
In all, 18 wounded.
The terrible conflict which was endured by the 9th Ill. Inft., in this
battle, will be seen from the number of killed and wounded. There
was present for duty when the Regiment went into the engagement,
570 men. Of these 348 were killed and wounded, and ten were
captured. One commissioned officer was killed, and 19 wounded.
Only four commissioned officers were left unhurt. I heard one of the
soldiers who was present at the time, say, that when they ceased
fighting on Sabbath evening, there were 70 men in line for duty, out
of the whole Regiment. It is said that Col. Mersy, when the Regiment
was first drawn up in line after the battle was over, shed tears,
saying, "Vel, vel; dis is all dat is left of my little Nint!" It must have
been a sad sight to see a Regiment, which numbered over 1,000
men when at Paducah a few month's previous, cut down to this
small number. But such is war.
Such was the battle of Shiloh, and such the part taken in it by the
9th Ill. Inft. The writer well remembers the feeling which prevailed in
the North with reference to it. There was rejoicing over it as a
victory. Still it was regarded as a dearly bought victory. There was a
very decided feeling that somebody was at fault. That the rebels had
completely surprised our army. That our pickets were out but a very
short distance. Hence, the surprise. Gen. Grant, as chief in
command, was faulted. It was charged that he was drunk at the
time. That he had disobeyed orders, and landed his men on the
wrong side of the river, etc. I heard a citizen of Chicago, not a month
ago, say that if Gen. Grant had made his appearance in Chicago
immediately after the battle of Shiloh, he would have been mobbed,
such was the feeling of indignation.
It is not my province here to write a defense of Gen. Grant. Nor is
it needed. His own brilliant career since that, has set him right in the
minds of the people. A man who has captured more prisoners and
more guns than the world-renowned warrior, Napoleon Bonaparte,
certainly does not need, at this day, a written defense of his military
career. Suffice it to say, the officers and men who fought under him,
even at Shiloh, become restless if a word is said against him.
Immediately after this battle, Gen. Halleck, who had charge of the
South-Western Department of the army, with his "Head Quarters" at
St. Louis, left that place for the field of strife and took command of
the army in person. Expectation was high in the North. It was
thought that now surely the rebels will be "pushed to the wall."
Never since the war broke out, has there been such intense anxiety
in the North-west, as that which filled the public mind during the
time which intervened between the battle of Shiloh and the
evacuation of Corinth. Many hearts were sad over friends who fell at
Shiloh. Every days' news was anxiously awaited, expecting it to bring
an account of another terrible conflict. The suspense was long and
painful. When the news finally came that Corinth was ours, but that
the enemy had evacuated it, there was a feeling of sadness ran
through the public mind. They were not prepared for that. They
were prepared to hear of many slain in the effort to take Corinth,
but not to hear that the enemy had fled and was out of reach.
The 9th Ill. Inft. remained in camp on the battle-ground of Shiloh,
exposed to all the sickening influences of the nearness of so many
dead animals, as well as offensive odor arising from the shallow and
imperfect burial, which necessarily had to be given to so great a
multitude of dead. In conversation with a citizen from Illinois, who
visited the battle-ground a week or ten days after the battle, I
learned from him that the offensive smell of the dead was almost
insufferable. That, together with the diet upon which the soldiers
had to live, produced disease to an alarming extent. Here the
Regiment remained in camp until the 29th of April, over three
weeks. On that day it removed, with camp and garrison equipage,
towards Corinth ten miles, and bivouacked. It moved forward again
on the 30th, five miles further, and went into camp. Here the
Regiment had muster and inspection by Col. Mersy commanding.
Here Brig. Gen. R. J. Oglesby took command of our Brigade, in
place of Col. McArthur who was severely wounded in the late battle,
Brig. Gen. T. A. Davies took command of our Division, in place of
Gen. W. H. L. Wallace who was mortally wounded.
On the first of May, moved camp five miles further towards
Corinth, and remained there until the 4th of May. On that day
removed to Monterey, Miss., and went into camp a little West of that
town, and remained there until the 8th of May, when another
forward movement was made, to within seven miles of Corinth,
finding no enemy.
The country here is very poor and broken, and water very scarce
and unfit for use. A great many of the men were sick with the
Diarrhea and Typhoid Fever. The Regiment remained here until the
14th of May, when it moved two miles further in the direction of
Corinth.
The Division moved forward again on the 16th, about one mile,
and formed a line, with Brig. Gen. Hurlbut's Division on our right. On
the 17th, moved forward again one mile, and one-half mile on the
19th. This brought our line within two and a-half miles of Corinth,
and within range of 32-pounder rifled guns. None were fired,
however, and the plain inference was, that the enemy had none. On
the 21st of May, our line advanced 400 yards, and again on the 29th
400 yards more. The pressure now became so heavy, that the
enemy evacuated Corinth, and moved Southward toward Okolona.
Thus it will be seen, our army was just one month moving from
Pittsburg Landing to Corinth, a distance of about thirty miles. Just
one mile per day. And this after having remained 22 days in camp,
before leaving the battle-ground. This, too, in pursuit of a fleeing
enemy. It will be difficult ever to convince the country that this great
delay was necessary. And yet many military men, who were present,
regard it as a master-piece of Generalship. The country through
which this vast army must pass, was entirely uncultivated. No army
could have subsisted in it, even for a few days. Had our army
advanced rapidly, they were exposed to a flank movement which
would have thrown the enemy between them and the river, and cut
off, as a natural consequence, our supplies. That done, and our
whole army would have been at the mercy of the enemy. There was
certainly great caution. But it was thought it was all needed.
When an advance was made, after halting, in an incredibly short
time, breast-works were thrown up to prepare for an attack. It is
amusing, even now, to hear the boys laughing at their expertness
with the spade. They all turned out to be pretty good Irishmen, so
far as the use of the spade is concerned.
Immediately upon the evacuation of Corinth, Gen. Davies'
Division, to which the 9th Ill. Inft. belonged, was ordered, with Gen.
Pope's army, in pursuit of the fleeing enemy. The rapidity with which
that pursuit was prosecuted, will be seen from the following record
of our daily marches. Is it to be wondered at that they were not
overtaken? On the first day we moved out five miles, and
bivouacked for the night near Farmington. Moved forward again on
the 31st, three miles, and went into camp on the Mobile and Ohio
Railroad. Here we remained in camp until the 5th of June.
The following events occurred while in camp here: On the 1st of
June the Regiment was paid for the months of January, February,
March and April, 1862.
On the 2d of June commissions arrived as follows: First Lieut.
James C. McClery, to be Captain Co. K; 2d Lieut. G. G. Low, to be 1st
Lieut. Co. K; and Sergt. James Oats, to be 2d Lieut. Co. K. Sergeant
Mallmann, to be 2d Lieut. Co. B; and Sergt. Gottlab, to be 2d Lieut.
Co. A.
On the 5th of June we again moved forward, eight miles, and
went into camp. On the 6th, moved forward and went into camp
near Boonville, Miss. Here we remained until the 12th of June.
General Davies, commander of the Division, being absent on sick-
leave, General Oglesby was in command of the Division; Col. Mersy
of the Brigade, and Major Kuhn of the Regiment.
On the 12th of June, the Regiment moved on its return towards
Corinth, fifteen miles, and went into camp. On the 13th, moved
again and occupied its old camping ground two and a-half miles
south of Corinth.
On the 17th of June, Col. Wright, of the 22d Ohio, being senior
Colonel, relieved Col. Mersy of the command of the Brigade, and Col.
Mersy went home on sick-leave.
The Regiment remained in camp here until August 16th, 1862.
During this time the following changes occurred: Captain Webb
resigned, and his resignation was accepted July 15th, 1862.
Lieutenant Purviance, of Co. I, was discharged August 16th, for
inability from wounds received in action at Shiloh.
On the 16th of August, in compliance with orders from Gen.
Davies, Division commander, the Regiment moved, with camp and
garrison equipage, to Rienzi, and reported for duty to Brig. Gen.
Granger, commanding at that place, by whom it was assigned to Col.
Schaeffer, commanding 2d Brigade.
Regimental Quartermaster, W. G. Pinckard, was promoted to be
Captain and Assistant Quartermaster, to rank from April 30th, 1862.
There are some incidents during the period covered by this
chapter worthy of note. During the battle of Shiloh, Lieut. Col.
Phillips was wounded. It occurred late on Sabbath evening. He says
the only time he had ever been scared since he has been in the
army, was when they were carrying him off the battle-field wounded.
The thought occurred to him, that now there was almost six feet
exposed to the fire of the enemy instead of one foot, forgetting for
the time, that while his body occupied an additional space
horizontally, it did not occupy so much perpendicularly, as when he
was on his horse.
C H A P T E R V.
FROM THE ATTACK ON CORINTH, OCT. 3D, 1862, UNTIL REGIMENT
WAS MOUNTED.

Rebels prepare to attack Corinth—Order of battle—Result of the


attack on the 3d of October—New line of battle at "White
House"—Line at "Battery Robinett"—Slaughter on the 4th of
October—Extracts from a Rebel prisoner's journal—List of killed
and wounded—Outpost duty.

The Rebel leaders were not satisfied that our forces should occupy
Corinth, uninterruptedly. Hence, in the Fall of 1862 active
preparations were made by them to attack that place. A heavy force,
under Generals Price and VanDorn, was fitted up for this purpose.
The time was drawing near when our boys must endure another of
those terrible struggles, two of which they had already passed
through.
As I have said, the Regiment had been doing outpost duty at
Rienzi, from the 16th of August until the last of September. On the
20th of September, Col. Schaeffer's Brigade, with which our
Regiment had been temporarily united, moved Northward, leaving
the 9th Ill. and the 59th Indiana, to hold the place. On the 1st of
October the 9th Ill. moved toward Corinth, and bivouacked for the
night seven miles South of our old camp near Corinth. Moved again,
on the 2d of October, and came to the old familiar camp, at noon.
Here we occupied our old position again, reporting to General
Oglesby, who commanded the Brigade.
On the morning of October 3d, 1862, the Regiment was marched
out in its proper position for the terrible conflict, The following order
will show the position it occupied during the fight. It was moved out
two miles North-west of Corinth, to the old rifle-pits of the rebels.
Our Brigade was on the left of the 2d Division. The 6th Division was
on our left. On the right of the 6th Division, was the 3d Brigade of
the 2d Division, (Col. Baldwin commanding,) which had been
temporarily attached to that Division. Gen. McArthur commanded the
6th Division; Gen. Davies the 2d Division, and Gen. Hamilton the
Ohio Division. This latter Division was held in reserve. Immediately
on our right was the 1st Brigade of the 2d Division. Such was the
position our Brigade occupied at the opening of this terrible conflict.
The enemy made their first attack upon Gen. McArthur's Division,
which was placed immediately upon our left. After a short
resistance, Col. Baldwin's Brigade, placed on the right of that
Division, gave way and fell back in confusion. This uncovered and
exposed to the enemy our left flank. Soon the enemy came through
the large gap thus made, and attacked us simultaneously in the front
and rear. The 81st Ohio, placed upon the left of our Brigade, gave
way and moved in confusion and disorder to the right and rear,
followed very soon by the 12th Ill., and then the 9th moved in the
same manner.
In attempting to check the too hasty advance of the Rebels, the
9th Ill. lost Capt. Britt, killed, and the two Captains Lowe, and
Lieutenants Hughes and Uleu, together with 53 enlisted men,
captured.
Gen. Hackleman's Brigade covered our retreat, and we fell back
and formed a new line at the "White House." The Brigades occupied
the same order in this line as in the former one. Here the advance of
the enemy was checked, until darkness put a stop to the conflict for
this day.
During the night our line was drawn back to Battery "Robinett."
Just before daylight, on the morning of the 4th of October, the
enemy cheered by their success of yesterday; opened from a four-
gun battery, on the town, compelling our wounded to leave for safer
quarters. A General Hospital was established one mile out on the M.
& C. R. R. where all the wounded were removed. Before they could
all be removed, one or two of them had been killed by the rebel
shells in the Tishomingo House. At daylight, the action became
general all along our lines. The Rebel columns made desperate
charges, and were as often repulsed.
General Oglesby, commanding our Brigade, was wounded the day
previous, and Col. Mersy assumed command of the Brigade. Major
Kuhn, of our Regiment, was also disabled, and Captain Hawes
assumed command of the Regiment during the fight on the 4th of
October.
The slaughter of the enemy, in the efforts to capture "Battery
Robinett," was terrific. A true picture of the ground, taken ere the
dead were removed, shows the ground to be literally covered with
the dead, often lying one upon another.
The struggle lasted until about 10 A. M., when the Rebel line was
broken, and their whole army retreated in confusion and disorder.
Thus ended another of those terrible conflicts which have marked
the history of this war. The conflict was fierce and determined on
both sides. Our forces were under the command of Gen. Rosecrans.
Those of the enemy were under Generals Price and VanDorn. It was
regarded a matter of vital importance, at that time, for our forces to
hold that place. The importance which the Rebels attached to the
work of re-taking it, and the desperate struggle they made in order
to do it, will be seen from some extracts which I will here make from
the journal of a Rebel prisoner, Lieut. Labruzan, of the 42d Regt. Ala.
A copy of his notes, taken as the battle progressed, and after he was
captured, was obtained by some of the boys in our Regiment, and I
have thus secured access to it. The following extract will show the
position the enemy occupied on the day before the battle
commenced:

"Thursday, Oct. 2d.—The bridge finished about 10 o'clock,


when we took up the line of march. We marched right in front,
which brought our Regt. near the head of the column. Generals
VanDorn and Villipigue were ahead about two or three miles.
The army here is fully 25,000 men under command of Gen.
VanDorn, who outranks Gen. Price. Brig. Gen. Moore
commanded our Brigade of five Regiments. Our Division is
commanded by Brig. Gen. Manny."

I omit here a portion of his notes as to the march during the day,
and the manner in which he spent the night of the 2d October. It
would be interesting to give the whole of this extract from his
journal, but it would occupy too much space. It would enable us to
view that great battle from a rebel stand-point. Of the first day of
the fight, he writes thus:

"Friday, Oct. 3d.—Reveille by the bugle at 4 A. M. Were


marching by 4 ½. Crossed into Mississippi at 7 A. M. Marched
just on the border for some miles. At 6 ½ heard some artillery
firing. Three miles ahead, skirmishing, which was kept up until
after we crossed the M. & C. R. R., which was at 9 ½ A. M. Saw
a Regiment skirmishing in a field just below us. The artillery
kept up a constant fire about three times a minute. Our Brigade,
under Gen. Moore, marching into the woods, formed, a line of
battle, our right resting on the Railroad. We had not waited
more than fifteen minutes, when heavy skirmishing was heard
about a half mile in front, with steady and increasing
cannonading. Two men from each company were detailed to
attend to the wounded, &c. We left blankets and knapsacks
here. About 10 o'clock our Brigade marched forward through a
corn-field, and formed into a line within a half mile of the
enemy. Heavy firing just in front. Saw a Major who was
wounded."

He proceeds, thus to speak of the fight of the 3d; but I will not
follow him further, on that day. Let us hear him describe the scene of
the 4th:

"Saturday, Oct. 4th.—An awful day. At 4 o'clock, before day,


our Brigade was ordered to the left about one-fourth of a mile,
and halted, throwing out lines of skirmishers, which kept up a
constant fire. A Battery in front of the right of our Regiment
opened briskly, and the enemy replied the same. The
cannonading was heavy for an hour and a half. Our Regiment
lay down close, and stood it nobly. The shell flew thick and fast,
cutting off large limbs and filling the air with fragments. Many
burst within 20 feet, and the pieces popped within 2 or 3 feet. It
was extremely unpleasant, and I prayed for forgiveness of my
sins, and made up my mind to go through. Col. Sawier called for
volunteers to assist the 2d Texas skirmishers. I volunteered, and
took my company. Captain Perkins and Lieutenant Wumson
being taken sick directly after the severe bombardment, I had
the Co. all the time. I went skirmishing at 7 ½, and returned at
9 ½ o'clock. We got behind trees and logs, and the way the
bullets did fly, was unpleasant to see. I think 20 must have
passed within a few feet of me, humming prettily. Shells tore off
large limbs and splinters. Struck my tree several times. We
could only move from tree to tree, and bending low to the
ground, while moving. Oh, how anxiously I watched for the
bursting of the shells when the heavy roar of the cannon
proclaimed their coming. At 9 ½ o'clock I had my skirmishers
relieved, by Captain Rouse's Company. Sent my men to their
places, and went behind a log with Major Furges. At 10 o'clock,
suddenly the fight fairly opened, with heavy volleys of musketry
and the double thundering cannon. This was on the right. In a
few minutes the left went into action in splendid style. At 10 ¼
o'clock, Col. Rogers came up by us, only saving "Alabama
forces." Our Regiment, with the Brigade rose, unmindful of the
shell or shot, and moved forward, marching about 250 yards
and rising the crest of a hill. The whole of Corinth, with its
enormous fortifications, burst upon our view. The U. S. flag was
floating over the forts and in town. We were now met by a
perfect storm of grape, cannister, cannon balls and Minnie balls.
Oh, God! I have never seen the like! The men fell like grass,
even here. Giving one tremendous cheer, we dashed to the
bottom of the hill on which the fortifications are situated. Here
we found every foot of ground covered with large trees and
brush, cut down to impede our progress. Looking to the right
and left, I saw several Brigades charging at the same time.
What a sight was there. I saw men running at full speed, stop
suddenly and fall upon their faces, with their brains scattered all
around. Others, with legs and arms cut off, shrieking with
agony. They fell behind, beside, and within a few feet of me. I
gave myself to God, and got ahead of my company. The ground
was literally strewed with mangled corpses. One ball passed
through my pants, and they cut twigs right by me. It seemed,
by holding out my hand I could have caught a dozen. They
buzzed and hissed by me in all directions, but I still pushed
forward. I seemed to be moving right in the mouth of cannon,
for the air was filled with hurling grape and cannister. Ahead
was one continuous blaze. I rushed to the ditch of the fort, right
between some large cannon. I grappled into it, and half way up
the sloping wall. The enemy were only three or four feet from
me on the other side, but could not shoot us for fear of having
their heads blown off. Our men were in the same predicament.
Only 5 or 6 were on the wall, and 30 or 40 in and around the
ditch. Catesby on the wall by my side. A man within two feet of
me, put his head cautiously up, to shoot into the fort. But he
suddenly dropped his musket, and his brains were dashed in a
stream over my fine coat, which I had in my arms, and on my
shirt sleeves. Several were killed here, on top one another, and
rolled down the embankment in ghastly heaps. This was done
by a Regiment of Yankees coming about 40 yards on our left,
after finding us entirely cut off, and firing into us. Several of our
men cried "put down the flag," and it was lowered, or shot into
the ditch. Oh, we were butchered like dogs, as we were not
supported. Some one placed a white handkerchief on Sergeant
Buck's musket, and he took it to a port hole. But the Yankees
snatched it off and took him prisoner. The men fell 10 at a time.
The ditch being full, and finding we had no chance, the
survivors tried to save themselves as best they could. I was so
far up, I could not get off quickly. I do not recollect of seeing
Catesby after this, but think he got off before. I trust in God he
has. I and Capt. Foster started together, and the air was literally
filled with hissing balls. I got about 20 steps, as quick as I
could, about a dozen being killed in that distance. I fell down
and scrambled behind a large stump. Just then, I saw poor
Foster throw up his hands, and saying "Oh, my God!" jumped
about two feet from the ground, falling on his face. The top of
his head seemed to cave in, and the blood spouted straight up
several feet. I could see men fall as they attempted to run,
some with their heads to pieces, and others with the blood
streaming from their backs. It was horrible. One poor fellow
being almost on me, told me his name, and asked me to take
his pocket-book if I escaped and give it to his mother, and tell
her that he died a brave man. I asked him if he was a Christian,
and told him to pray, which he did, with the cannon thundering
a deadly accompaniment. Poor fellow. I forgot his request in the
excitement. His legs were literally cut to pieces. As our men
returned, the enemy poured in their fire, and I was hardly 30
feet from the mouth of the cannon. Minnie balls filled the stump
I was behind, and the shells bursted within three feet of me.
One was so near it stunned me, and burned my face with
powder. The grape-shot hewed large pieces off my stump,
gradually wearing it away. I endured the horrors of death here
for half an hour, and endeavored to resign myself and prayed.
Our troops formed in line in the woods, and advanced a second
time to the charge with cheers. They began firing when about
half way, and I had to endure it all. I was feigning death. I was
right between our own and the enemies fire. In the first charge
our men did not fire a gun, but charged across the ditch, and to
the very mouth of the cannon, with the bayonet. So also the
second charge, but they fired. Thank God, I am unhurt, and I
think it was a merciful Providence. Our troops charged by, when
I seized a rifle and endeavored to fire it several times, but could
not, for the cap was bad. Our boys were shot down like hogs,
and could not stand it, and fell back each man for himself. Then
the same scene was enacted as before. This time the Yankees
charged after them, and as I had no chance at all, and all
around me were surrendering, I was compelled to do so, as a
rascal threatened to shoot me. I had to give up my sword to
him. He demanded my watch also. Took it; but I appealed to an
officer, and got it back. I had no means of defending myself for
the first time in many years. I cried to see our brave men
slaughtered so, and thought where Catesby might be. I have
never felt so in all my life. It is now said that our Brigade was
never ordered to charge such a place, and that it was a mistake.
If so, it was a sad one. Being brought behind the works we
found three Regiments drawn up in line, and all of them were
fighting our 42d Alabama alone. I helped to carry a wounded
man to the Depot, with Lieutenants Marshall, Contra and
Preston, they being the only unhurt officers who were prisoners
from our Regiment. We and the privates were soon marched to
a large house, having a partition for the officers. The men,
about 400, in next room. I heard firing again, but I fear we can
do nothing. We are treated very politely—more so than I had
expected."

Perhaps the reader is now ready to ask what this long extract from
a secesh officer's journal, has to do with the history of the 9th Ill.
Inft. Well, it is not very intimately connected with it. But it has been
preserved by the boys in the Regiment, and all agree that it gives a
very correct account of that terrible battle. It has, however, this
connection with our history: It shows the desperate nature of that
struggle, in which our boys took so active a part. It shows that they
had a foe to contend with, full of courage and who fought with
desperation.
It was truly a terrible battle. One officer who was on the ground,
told me that he at one time thought the rebels would succeed in
driving us out.
The loss sustained by the 9th Regt. Ill. Inft. in this terrible conflict,
was 20 killed and 82 wounded. Captain Britt was among the killed.
The following officers were among the wounded: Major Kuhn, Adjt.
Klock, Captains Kneffner and Robinson, and Lieutenants Rollmann,
Williford, Clements and Cowgill. There were 57 captured, including
Captains E. M. and G. G. Low, and Lieutenants S. T. Hughs and B. L.
Ulen.
The following is a list of the killed and wounded, in the various
companies:
Company A.—Killed, Charles Gibrich—1. Wounded, William
Kortkamp—1.
Company B.—Killed, Joseph Cropp and Jacob Sulzer.—2. Wounded,
Captain Kneffner, Anton Weenstroth, Sergeant John Eichenberger,
Corporal Louis Fisher, Paul Geist, Ed. Hoffmann, George Jenne,
Nicholaus Meyer, Jos. Noelsner, George Salz, Daniel Werner,
Sergeant Augustus Wurmb. In all, 12 wounded.
Company C.—Killed, Corporal John Fangemann, and Frederich
Hugenberg.—2. Wounded, 1st Lieutenant Oscar Rollman, 2d Lieut.
Charles Sheve, Privates John Miller, Peter Schneider, John Frietz,
Christian Jackob, Christian Maedel, Henry Behm, and Jacob Herpein.
In all, 9 wounded.
Company D.—Killed, Jacob Berthold, Hy. Borchording, John Smith,
Christ Truting, Louis Truttman. In all, 5 killed. A number were slightly
wounded—names not given.
Company E.—Wounded, Corporal Francis J. Murphy, Privates William
T. Grimley, Jack L. Stevens, James F. Williams, James Malone, John
Lill, John Beatty, William P. Kelley, Neal Vestal. In all, 9 wounded.
Company F.—Killed, Captain William Britt, Privates John O. Foeshee,
and Fred. Weggourd. In all, 3 killed. Wounded, Sergt. W. C. Hawly,
Corp. James Fiske, Private William Miller. In all, 3 wounded.
Company G.—Killed, Alferd Bartley and John McCord. In all, 2 killed.
Wounded, Lieutenant I. Clements, Henry Brown, James A. Peragin,
William J. Heglar, Robert Marshall, N. G. Brown. In all, 6 wounded.
Company H.—Killed, Sam'l Giesinger, John B. Livingood, Sebastian
Swendeman. In all, 3 killed. Wounded, 1st Lieutenant C. H. Gilmore,
2d Lieutenant A. Cowgill, James Brady, William S. Boone, Dennis
Bahon, Charles Biernbrier, William A. Cottingham, Robert Finley,
Israel Haller, Charles H. Newcomb, George W. Quails, Wm. Reckord,
Francis M. Stickle, O. W. Boutwell, Venice C. Haller, Ambrose J.
Shelton, Jos. W. Warren. In all, 17 wounded.
Company I.—Wounded, Thomas Pat, William Baird, John Jaka,
James Lang, Jos. E. Stringer. In all, 5 wounded.
Company K.—Killed, James Ulen.—1. Wounded, George Myers, Levi
Gibbs, Henry Stanger, John Burke, Charles W. Boles, Jos N. Coneden,
Peter Hall, Sam'l C. Ulen, Frank M. Winsted. In all, 9 wounded.
The enemy driven from Corinth, our Regiment was again thrown
out on the front, a position it had been occupying for some time
before the battle. On the 8th of October, it moved South to Danville,
Miss., and on the next day the left wing, Companies K, I, H, G, and
F, moved on to Rienzi. Col. Mersy took command of all the troops at
Rienzi, and Lieut. Col. Phillips, who had now rejoined the Regiment,
after his severe wound at Shiloh, of the forces at Danville. The
Regiment, with other troops of the 2d Brigade, performed outpost
duty at the above named places until the 28th of November, 1862,
when they returned and went into camp at Corinth, Miss.
On the 12th of December, the Regiment moved Southward again,
going within five miles of Tupelo, Miss., and returned to camp at
Corinth on the 19th of the same month; Col. Mersy being in
command of the 2d Brigade, and Lieut. Col. Phillips in command of
the Regiment.
On the 2d day of January, 1863, we moved three and a half miles
East of Monterey, and bivouacked for the night, and returned to
camp the next day; Gen. Forrest and his command having escaped
across the river. The Regiment remained in camp until March, not
having much duty, except guard duty.
During the period embraced in this chapter, some interesting
incidents occurred. As I mentioned above, the two Captains Low,
and Lieutenant Hughs, together with a considerable number of
privates, were taken prisoners. I have given extensive extracts from
the journal of a Rebel prisoner, showing the horrors of the battle-
field. It may not be amiss to refer to some things connected with the
prison-life of some of our boys, who were captured in this battle at
Corinth.
The scene, as described by Captain G. G. Low, to the writer,
beggars description. The horrors of their retreat was terrible. The
Captain thinks if Napoleon's retreat from Moscow was much more
terrible, he does not know how it was endured at all. But I shall here
allow the Captain to speak for himself, by giving extracts from a
written statement, which he kindly furnished me, of his prison-life:

"On the morning of the 3d of October, 1862, our Regiment


received orders to move early in the morning. We had moved up
the day before from Rienzi, to within 2 ½ miles of Corinth. As
we approached Corinth, we could occasionally hear the boom of
distant cannon. Conjecture was rife as to what it meant, so little
did we expect an action. We passed through Corinth, and to the
outer works on the West of it. Sometime before we obtained our
position behind the rifle-pits, three had been heavy fighting on
our left. We took our position here, feeling confident we could
hold it against a vastly superior force. The enemy were
gradually approaching from the front, and our line was being
engaged, when I noticed a panic in my company. I was on the
extreme left of our Regiment. Many of my men broke out of the
ditch and started back. I ordered every man back to his place.
They told me the 12th Ill. and 81st Ohio were running. I told
them it mattered not; we would stay there until we were
ordered away. I saw a change of front was necessary, and
expected to hear the order to change front to rear, on first
company. But it did not come. Soon after, I heard the order to
move by the right flank; but it was too late. Already the enemy
were in our rear. I saw it would be death for my men to attempt
to leave their position, and I surrendered with seventeen of my
command.
"We were moved back about three-fourths of a mile. I found
that Captain C. M. Lowe and Lieutenant L. T. Hughes of our
Regiment, were captured. We were placed under guard at or
near a house. Here a woman abused us very much. She insisted
that Captain Lowe was the mean Yankee that was there the
night before and stole her chickens. The Captain assured her
that he had never been there before, and that she must be
mistaken. She was certain he was the man, and had it not been
for the guard, she would have pitched into him rough-shod. I
think she was as hard a specimen of the fair-sex as I have ever
seen in the Sunny South; and I have seen many that outraged
decency and forever disgraced the name of woman.
"After the excitement of the battle was over, or rather of the
scenes through which we passed that day, we had time to
reflect. Here we were, prisoners of war, held by a motley set of
human beings that, as far as outward appearances were
concerned, would be a disgrace to barbarians. I wondered, "Is
this the boasted chivalry of the South, sent out to fight the
hated poor men of the North, the 'mud-sills' and 'greasy
mechanics?'" When I saw my poor boys, dressed in their blue
uniform, contrasted with these rag-a-muffins, I felt proud of
them.
"The "Rebs" had great stories to tell us. Bragg had captured
Louisville and all Buell's army. Lee had captured Little Mac. and
40,000 prisoners. Governor Gamble, of Missouri, had turned
over 40,000 troops, well armed and equipped, to the Southern
Confederacy; and they had come with 70,000 men to capture
Corinth, and drive Grant out of West Tennessee, and the war
would be over in a few days. All were jubilant.
"At night, we moved in the woods about a mile, and were
consoled with a lot of wounded of both armies. About 9 o'clock
at night, the news came back that they had captured Corinth,
and we would be moved up there in the morning. About this
time, Col. Prevene, of a South Carolina Regiment, came to see
us, (he was a Mason,) and took Capt. Lowe and myself outside
the lines and had a long talk with us. He assured us that Corinth
was not taken, and that it would not be; and further, that Gen.
VanDorn was (to use his own language) a d—d fool for
attacking the place. To-night we had nothing to eat, except a
cup of coffee that a Rebel Lieutenant made for us. I furnished
the coffee. We passed a restless night.
"The morning of the 4th dawned, and was ushered in with
the boom of heavy cannon. This assured us that the place was
not taken, but that they had approached very near it, as we
could hear the guns of the forts. The cannonading and musketry
was incessant from daylight until about 1 P. M. At that time,
orders came to move us back to the rear. We took up our line of
march to Dixie. Although we were prisoners in the hands of the
enemy, yet we were jubilant. We knew they had been repulsed;
that the stars and stripes had again been triumphant; and
though we had a prison-life, and even starvation staring us in
the face, yet there was not a man despondent. We were then
suffering for something to eat, but we knew the "rebs." were
suffering even more than we were; for they had nothing to eat
when they attacked Corinth, and their only hope for something,
was the capture of the place. In this they had failed. The retreat
soon became a rout. Neither tongue nor pen can describe the
sufferings during that memorable retreat. Wagons, with six
mules attached, were filled with the wounded and dying, and
the cowardly drivers whipping their mules at every jump. The
groans of the dying and the curses of the wounded were
enough to make the knees of terror tremble. One would think,
that if human suffering would expiate the crime of treason, all
this army should be forgiven; for they suffered from hunger,
thirst, fatigue, and all the ills that follow a defeated, routed,
broken and disheartened army. I could not help feeling sorry for
the panic stricken wretches.
"At night, we camped about twelve miles from Corinth, on a
little branch. I had coffee enough to make us a cup apiece. This,
and a few crumbs of crackers, was all we had for twelve of us—
eight Federal officers and four Rebel officers." (It will be
remembered they had had nothing to eat the day before, and
very little on the preceding day.) "We camped near a house, and
there was a rooster, the only chicken left on the premises. We
offered five dollars for it. The woman would not let us have it.
"On the morning of the 5th of October, we again moved,
escorted by a company of the Rebel Jackson's cavalry, under
command of Capt. Douglass. Let me mention here, that Capt. D.
did all in his power to make his prisoners comfortable. While we
were being marched back on the afternoon of the 4th, an aid of
Gen. VanDorn's rode up and told him to move the prisoners
faster. He said, 'If I move them faster they will fall down from
exhaustion.' The aid replied, 'Let them fall, and be d—d. Shoot
them if you cannot get them along.' But the Captain took his
own gait, and treated all kindly. As we marched along this
forenoon we saw a great number of their wounded on all sides
of the road. About 1 o'clock we came in sight of Hatchie Bridge.
We halted for a few moments, and soon we heard fighting in
front of us. We were taken back about one mile, and halted in a
hollow. We had been there but a few moments, when rifle shells
came whistling in such close proximity that we had to retire
further back. Soon we saw the Rebel mass come running back
in, if possible, greater confusion than the day before. They
thought the whole Rebel army would be captured. They took up
the Hatchie about ten miles and crossed us, and we halted
about 12 o'clock that night, near Ruckersville, Miss. Here they
killed a beef weighing about 300 pounds, for the 300 prisoners
and their guards, in all over 400. We had had nothing to eat
that day but raw corn. We ate the beef without salt.
"On the morning of the 6th, we started towards Ripley,
without anything else to eat. Arriving at that place late in the
afternoon, they gave us a very little to eat, perhaps rations
enough for fifty men. On the following morning we moved in
the direction of Holly Springs, Miss. The day was very hot and
the roads dusty. Add to this, the suffering from hunger, and it
would be hard to describe the amount of suffering the men
endured. We camped at night near a Mr. Robinson's. (To-day we
had to march about nine miles out of the way, on account of
some one destroying a bridge in the rear of the retreating
army.) The officers got a very good supper at Mr. R.'s, by paying
one dollar each, in Greenbacks. He would not take anything
else. The men got but little to eat.
"On the morning of the 7th, the officers hired a team to take
them to Holly Springs, for which they paid $20. We arrived there
at 11 o'clock at night. Here we were taken to Col. Roddy's Head
Quarters, He said he was surprised that we, being North-
western men, were fighting Southern men. Captain Lowe told
him that we were not in a condition to resent an insult, and did
not wish to be insulted. This ended the conversation.
"The next evening we started by Railroad, under guard, for
Jackson, Miss., arriving there about 10 A. M., on the 9th of
October. Here we were taken before General Thillman, and
paroled for that city and Vicksburg. We had good rooms at the
best hotel in Jackson. On the morning of the 10th we took cars
for Vicksburg. On this trip We had no guard, except one Rebel
Captain. We arrived at Vicksburg about 1 o'clock, and were
quartered at the 'Washington Hotel.' We were limited to certain
streets. Otherwise we had our liberty. Our fare at the hotel was
corn bread, corn coffee, fresh beef and molasses. The ladies
were allowed wheat-bread, and when the darkies could do so
without being detected by their master, they would supply us
with that luxury. On the whole, we were treated pretty well by
the 'Rebs.' We found them generally dispirited; but said they
thought they never could be conquered, &c.
"On the 18th of October, we were paroled, and started up the
river to meet our flag of truce boat. The sight of the old flag
and hard bread created great joy among our men. Hard
treatment, under a flag of treason, had endeared the old flag to
them. A scanty supply of corn bread, and beef without salt,
made 'hard tack' look and taste like the best food cooked. On
the morning of the 19th of October, 1862, we took our course
up the river for 'God's country.'"
A little incident narrated by Private Neal Vestal, of Co. E, who was
taken prisoner at the same time with Captain Lowe, is worth noting.
When the Rebs. were attacked by General Hurlbut, at the Hatchie on
the 5th of October, and a panic was arising, a Rebel Captain passing
by Neal, he inquired, good naturedly, "Well, Captain, what are you
going to do with us now?" His reply was, "If I had my way, I would
shoot you." At which Neal replied, "I bet six bits that man was not in
the fight." At this response went up all along the line, "That is true!"
CHAPTER VI.
FROM THE MOUNTING OF THE REGIMENT TO LEAVING
POCAHONTAS.

Regiment mounted—Scout to Tuscumbia, with its five engagements


—Scout to Florence, with two engagements—Move camp to
Pocahontas—Scout to New Albany, destroying the town—Mud
Creek scout and battle—Scout to Jackson, and battle—Scout to
Ripley—Scout to Trenton, Tenn.—Scout to Grenada—Raid to
Grenada—Commissions and promotions—Battles of Salem,
Graham's Mills and Wyatt's—List of killed and wounded—Incidents.

Our Government, by the beginning of 1863, began to see the


necessity of having a larger mounted force. It was proposed that
many of the Infantry Regiments should be mounted for scouting
purposes. Lieut. Col. Phillips made application to have the 9th Ill.
Inft. mounted. He was told that it could be mounted on mules, but
not on horses. He replied that he would prefer the mules, as they
would endure more hard usage and require less care. Hence, on the
15th of March, 1863, Lieut. Col. Phillips, commanding Regiment,
received orders to mount his command, on mules, for scouting
purposes. The Regiment was all mounted by the 20th of March.
Col. Mersy was in command of the 2d Brigade, and Lieut. Col.
Phillips of the Regiment. This arrangement still continues, to the
present date.
Sergeant George Rhuland, of Company A, was commissioned as
1st Lieutenant of said company. He ranks from March 20th, 1863,
the date of the receipt of his commission.
The Regiment was paid on the 26th of August, by Major Phelps,
for the months of May and June.
On the 14th of April, the Regiment received orders to be ready to
move by daylight the next morning. The order was afterwards
changed to moving in half an hour. We were soon on the way
towards Glendale, where the rebels had made a dash on a small
body of the 64th Ill. Vols. We reached Glendale a little too late, as
Col. Cornyn had driven the enemy and started in pursuit. The
Regiment hastened forward and found him at Yellow Stone Creek.
We were delayed one and a-half hours in crossing this very muddy
stream. Hence, we bivouacked for the night two miles beyond.
Moved forward rapidly, on the 15th, and bivouacked within four
miles of Big Bear Creek, on the opposite bank of which, we were
informed, there was a large body of the enemy. We awaited here, on
the 16th, the arrival of the Infantry force from Corinth. All having
arrived, we moved rapidly, early on the morning of the 17th. After
"shelling the woods" for a short time with our rifled pieces, the
following mounted forces, viz: 10th Missouri Cavalry, battalion of the
15th Illinois Cavalry, and the 9th Illinois Mounted Infantry, dashed
rapidly across the creek. Captain Richardson was throwing shell over
our heads at an imaginary force across the creek. As he did not stop
soon enough, a number of his shell flew among our men, but
fortunately no one was hurt. As soon as all the mounted force was
over, and one section of Tamrath's Battery, we moved forward on the
Tuscumbia road.
At Dickson's we ran upon the enemy's videttes, driving them back
to "Buzzard Roost" or "Cherokee Bluffs," where they made a stand,
and the place being naturally strong, our shell could not dislodge
them. Consequently, the 9th Ill. Mounted Infantry was dismounted,
and deployed as skirmishers. They advanced rapidly to within one
hundred yards of the bluff, and then the right wing swung around on
the left flank of the enemy, compelling them to leave the bluff very
rapidly, and in great disorder. About 25 of the Rebels were killed,
wounded and captured. Our loss was five slightly wounded, none
disabled. The weather being intensely hot, the horses in the section
of battery with us, became too much exhausted to move further.
Their ammunition was also about exhausted. The two guns were
consequently left at this place to await the arrival of the main force.
Lieutenant Krebs, with Co. D, was left to support the guns, in case of
an attack. There were also seven men of Co. I left here to guard the
prisoners.
Immediately after crossing the creek, one company of the 10th
Mo., and one of the 9th Ill., were ordered to move two miles out on
our left flank, and break up a camp of the enemy said to be in that
direction. Lieutenant Patterson, with Co. E of our Regiment, was
ordered on that expedition. This detachment drove the rebels from
their camp, toward their main body on the Tuscumbia road. This
body of the enemy, 250 strong, came upon the two guns of
Tamrath's Battery that we had left at Cherokee Bluffs, and before the
guns could get to us, they, and all of Co. D, except three men, and
the seven men of Co. I, were captured. We moved rapidly back, and
succeeded in recapturing one of the guns in "Lundy's Lane."
Col. Cameron, of the 1st Alabama Regiment, (loyal,) was killed
here in the charge. The Rebels fled to the timber on our left, beyond
the reach of our muskets, and too far off for the effective firing of
the "Mountain howitzers."
Col. Cornyn now ordered us to fall back and rejoin the main body,
as we numbered only 1200, all told, while the enemy were not less
than 2500 strong. Scarcely, however, had we left "Lundy's Lane,"
before the enemy filed out of the timber and formed a line across
the open field, threatening our rear. The advance of the Infantry
force being now only one mile back, we turned about and
confronted our foe. The 9th Ill. Inft. dismounted, and moved around
to the left flank of the enemy's line, while the cavalry charged their
front. They broke and fled beyond a high ridge, and we advanced
rapidly and took possession of the ridge. In the meantime, Col.
Bane's Brigade, and Welker's Battery came rapidly on the field,
unobserved and unknown to the Rebels. This Brigade was
immediately posted as follows: The 50th Ill. behind a high grading of
the Railroad and to the left of the open field, on which the Rebels
had formed their line previous to being driven back by our Cavalry;
the 7th Ill. Inft. were moved in the timber, around to the right of the
field, and a little further advanced than the 50th; the 57th Ill. were
held in reserve. The Cavalry received orders to fall back rapidly, and
in apparent confusion, as soon as the enemy should appear on the
ridge.
This disposition being made of the forces, the 9th Ill. Inft. fell back
100 yards, to a fence overgrown with bushes, and lay concealed
behind it. The Rebels advanced with loud shouts, and planted a 12-
pound Howitzer on the ridge. Our Cavalry hastily retreated, and the
enemy believing victory certain, dashed gallantly ahead, when the
50th and 7th Ill. Regiments opened on them a deadly fire. About the
same time, a body of the enemy appeared on the left of the Railroad
on the ridge. They were opened upon by the 9th Ill. The contest was
not long. In less than ten minutes, the whole body of the Rebels
were in rapid retreat towards Cane Creek.
The loss of the enemy was, according to their own statement, 17
killed, 50 wounded, and 23 taken prisoners. The 9th Ill. lost 5
wounded and 59 captured (Co. D.) The entire Union loss was 3
killed, 10 wounded, and 75 captured.
Night now coming on, we bivouacked near the battle-field. On the
18th, after a reconnoisance in front, and finding the enemy in strong
position near Cane Creek, our whole force fell back to Bear Creek,
and went into camp.
On the 19th, Companies E and F were sent, as escort to a train, to
Eastport Landing. The rest of the Regiment, with the whole mounted
force, moved circuitously to "Buzzard Roost," and found the enemy,
under Roddy, occupying the same position as on the 17th at
Cherokee Bluff. Our Regiment was again deployed as skirmishers, in
the same manner as before. After fifteen minutes skirmishing, we
drove the enemy from his position, killing, wounding and capturing
13 of them, and losing none.
We then returned to camp at Bear Creek, taking with us a drove
of cattle and sheep. On the 20th of April, the 7th Kansas Cavalry
joined us, and on the nest day the Ohio Brigade, Col. Fuller
commanding. Our entire column moved forward on the morning of
the 23d, and crossed Cane Creek without opposition; the Rebels
having fallen back to Little Bear Creek. Here General Dodge offered
battle, but they declined, and we bivouacked for the night. We
moved forward again on the 24th, the enemy continually falling
back, not even making a feeble resistance at Little Bear Creek,
although the position was a very strong one.
On nearing the town of Tuscumbia, the enemy, under Forrest, left
on the Decatur road. Col. Cornyn was ordered forward after them,
with the 10th Mo. Cavalry, the 7th Kansas Cavalry, and the 1st
Alabama Cavalry. Lieut. Col. Phillips, with two companies of Cavalry,
two companies of 9th Ill. Inft., viz: A and B, and two guns of
Tamrath's Battery, was ordered to move up to Florence, and capture
the town. He proceeded to that place with his command. Arriving on
the bank of the river, opposite the town, and observing a small force
of cavalry in Florence, he called to them to send him over a boat, as
he desired to send over a flag of truce. They replied, telling him to
go to that place, where I suppose but few, if any, desire to go. The
Col. did not feel disposed, at least to obey their orders, and thinking
he had that with which he could enforce obedience to his, he placed
his two rifled guns in position, and made a second demand for a
boat. To this he received the same reply, as before. Immediately he
opened upon them with his two guns, throwing shell into the town.
The cavalry on the other side broke and ran. As they passed up the
street, a shell was thrown among them, killing one horse. In a very
short time, white flags were hung out all over the town. In the
meantime, a small raft had been constructed, on which a flag of
truce was sent over, and the Mayor of the town made a formal
surrender. The object of demanding the surrender was, not that we
might hold the place, but that we might ascertain whether the
enemy had any considerable force there. The desired information
being gained, the Col. evacuated it, and returned to the main force
again.
The remainder of our Regiment, and the battalion of the 15th Ill.
Cavalry, were ordered to move forward, within supporting distance
of Col. Cornyn. We moved forward until near night, and not being
able to reach him, we returned to Tuscumbia, and bivouacked. At 10
o'clock that night, we received orders to move out rapidly and join
Col. Cornyn, as he feared the enemy would come upon him, too
strong, at daylight, his forces being very much exhausted. We
reached him, beyond Leighton, by 2:30 A. M., on the 25th, and at
daylight the whole force returned to Tuscumbia.
Our Regiment turned over 200 mules to Col. Streight, on the 26th,
to complete the mounting of his force, thus dismounting Companies
C, D, E, G, H and K, of our Regiment.
On the morning of the 27th April, we again moved forward,
toward Decatur, to attract the attention of Forrest, until Col. Streight
had moved entirely around his left flank towards Atlanta. We found
the enemy posted at Town Creek, four miles beyond Leighton. Some
picket skirmishing took place before night. We bivouacked near the
Creek. Early on the morning of the 28th, the Rebels having
discovered the position of the dismounted companies of our
Regiment, opened upon us with schrapnel, compelling us to fall back
hurriedly out of their range. The artillery kept up a constant firing all
day, and after noon a part of the 81st Ohio and the mounted
companies of the 9th Ill., crossed over, at the Railroad bridge, and
drove the enemy from their position.
Col. Streight having now completely passed the enemy, our entire
column moved on the return march, on the morning of the 29th
April. Bivouacked for the night near Little Bear Creek. Reached Big
Bear on the 30th, and were compelled to remain in camp there until
the evening of the 1st of May, when a bridge having been
constructed, we crossed over and proceeded up the Railroad to our
old place of camping, four miles from Big Bear Creek. From there we
proceeded on the main traveled road to Burnsville, reaching that
place sometime after night, and bivouacked. On the morning of the
2d May, Lieut. Col. Phillips, with the four mounted companies, viz: A,
B, I and F, was ordered to report to Col. Cornyn, commanding
cavalry force, for an expedition to Tupelo. The rest of the Regiment
moved forward, at 10 A. M., and reached Corinth by 2 P. M.
During this trip the Regiment was out from camp 18 days, and
had five engagements with the enemy—two on the 17th of April,
one on the 19th, one on the 27th, and one on the 4th of May. The
great object of this expedition, was to divert the attention of the
enemy until Col. Streight, who was fitting up an expedition for a
grand raid into Georgia, should have time to complete the mounting
of his men, and get well started on his way.
Lieut. Col. Phillips, with the four mounted companies of our
Regiment, having been ordered on an expedition to Tupelo,
separated from the remaining companies at Burnsville, on the 2d of
May, and proceeded to Tupelo. Had a skirmish with the enemy there,
and rejoined the Regiment at camp, May 7th.
Quartermaster Korn died of disease May 6th, 1863. Dr. Guelick
and Captain Hawes were detailed on the 7th of May, the former to
Fort Henry, and the latter to Memphis. Dr. Wm. A. Allen, 2d Assistant
Surgeon, appointed by the Governor of Illinois, reported for duty on
the 12th, and was mustered into the service, to rank from that date.
On the 13th of May, the Regiment moved into the barracks
formerly occupied by the 39th Ohio, one mile south-east from
Corinth.
On the 15th of May, Brig. Gen. Thomas, Adjutant General U. S.
Army, addressed the soldiers at Corinth, announcing and advocating
the policy of the Government in regard to freeing and arming the
negroes. His remarks met with a hearty approval by nine-tenths of
the soldiers at the military post of Corinth.
May 26th, our Regiment being again all mounted, we were
ordered to report to Col. Cornyn, commander of Cavalry Brigade, at
10 A. M. Moved immediately thereafter, on the Corinth and Hamburg
road, toward Hamburg Landing. We reached that place and began to
cross the Tennessee River about dark, the 9th Ill. crossing over first.
Our Regiment all got over by 2 A. M., of the. 27th, and the
remainder of the force by noon of the same day. At 1 P. M., the
entire column moved forward on the road towards Florence, taking
the most easterly route. Halted, for rest and feed, two hours at 1
o'clock, A. M., of the 28th, and then moved forward again eight
miles North-east from Florence. A detachment of the 7th Kansas
Cavalry destroyed two large woolen factories, four miles from the
city. We drove in the videttes of the enemy, and when we were
within one hundred yards of the town, they opened on us with a
battery of two guns, throwing schrapnel with great accuracy,
compelling us to move from the road, by the left flank, into the
timber, to avoid the deadly missiles. Col. Cornyn moved his howitzers
rapidly forward, and soon silenced the Rebel guns.
The 9th Ill. was now dismounted and thrown forward as
skirmishers. The 1st Battalion, (Cos. A, B and C,) Lieutenant Ruhland
commanding, moving forward in column, as reserve. The opposition
of the enemy did not amount to much, and we soon had possession
of the town. Our loss was two wounded, and two captured. The
enemy lost from ten to twelve killed and wounded, and sixty to
eighty captured. After searching the town, and destroying all the
stores of value to the enemy, we began out return march, taking the
most westerly route, so as to destroy three large cotton mills and
two more large woolen mills, all of which we succeeded in doing
without loss to us. At 12 o'clock, midnight, we bivouacked until
morning. The enemy disputed our entire advance from Florence to
the place of bivouack, and then ceased to molest us. We reached
the crossing opposite Hamburg, at 2 A. M., of the 30th May, when
we bivouacked until morning.
During the day the enemy appeared in force in our rear, before we
had even our baggage across, and as Col. Cornyn had moved down
to Savannah to relieve the 10th Ill., Lieut. Col. Phillips assumed
command, and moved out one-half mile from the river and offered
battle, when the Rebels hastily fell back. We succeeded in all getting
over by 2 A. M. of the 31st, without further molestation. In the
skirmish the opposite side of the river, none of our men were hurt.
The enemy lost several in wounded and captured, none are known
to have been killed. At 7 A. M., the 31st, the entire column moved
toward Corinth, and we reached camp there at 1 P. M.
During this expedition, the Regiment was out six days, and
engaged in two skirmishes with the enemy. The object of the
expedition seemed to be the destruction of public property and
stores which would be of advantage to the enemy.
After leaving Hamburg Landing at 1 P. M., of the 27th May, the
boys were in their saddles, or pack-saddles, as they then were, for
about thirty-six hours almost constantly, except the few hours they
were in Florence searching the houses for arms, and destroying
stores that might be serviceable to the enemy. At 12 o'clock, on the
night of the 28th, they halted, until early in the morning, when they
were off on the march again. The result of this raid was 64 prisoners
captured, over 200 negroes brought in, a large number of mules and
horses captured, about $3,000,000 worth of Factory property
destroyed.
On the 3d of June, 1863, the Regiment received orders to be
ready to move on the next morning, at 8 o'clock, with camp and
garrison equipage. Moved on the 4th, in accordance with the above
order, in a North-west direction. Passed through Cherwalla, and
bivouacked for the night about ten miles west of it. The Tuscumbia
and Hatchie Rivers had to be bridged, in order to cross the artillery
and infantry. The entire Brigade were moving with us. These streams
were bridged, the forces crossed, and we arrived at Pocahontas by 4
P. M., on the 5th of June, and bivouacked in the town for the night.
On the 7th, the Regiment moved into camp one-fourth mile north of
the town.
On the 8th of June, Lieut. Col. Phillips, with Companies A, B, E, F,
G and I, moved south on a scout, and returned on the 9th, at 1
P. M., bringing in a drove of cattle and sheep. The remaining
companies of the Regiment went as an escort to a train of wagons,
as far as the bridge on Tuscumbia Creek.
On the 11th of June, Capt. Kneffner, with Companies A, C, E, H
and I, moved North-west on a scout, and returned in the evening,
having marched 40 miles, bringing in three prisoners.
The Regiment, accompanied by one section of Tamrath's Battery,
moved south on the Ripley road, on the 12th of June, at 1 P. M., and
bivouacked for the night within ten miles of Ripley. Moved forward
early on the morning of the 13th, and took possession of Ripley
without opposition. The town was searched, but nothing of a
contraband nature was found, except a number of negroes, who
were confiscated for the use of the Government. Moved on in the
direction of New Albany. At Orizabo, the flankers on our left
encountered a few Rebel soldiers, and after driving them off, burned
the place, as it contained Rebel stores and was a place of
rendezvous for them. While stopping to feed, about four miles south
of Ripley, a family moving to Ripley came along. Their wagons and
carriage were searched, and a Rebel mail was found in the old lady's
carpet-sack. Their horses and mules were all confiscated, except one
old team of mules which they were allowed to keep.
The Regiment then proceeded to New Albany, reaching that place
about 4 P. M. Finding the town nearly deserted by citizens, and used
as a general Headquarters for guerrillas, and a supplying point for
them, it was entirely destroyed, after any stores of value that could
be carried away were taken.
We then moved back toward Ripley, on a different route from the
one by which we had entered, going three miles and bivouacking for
the night.
At 1 o'clock, A. M., June 14th, Lieutenant Krebs and escort came
into our bivouack from Pocahontas, with orders from Col. Mersy, for
us to return as rapidly as possible to camp at Pocahontas, as the
enemy were planning to capture us. We moved at 2 A. M. Reached
Ripley at breakfast time, and camp at Pocahontas at 8 P. M. At
daylight this morning, the enemy, 1500 strong, reached our last
night's bivouack. But fortunately we were safe out of their reach. It
was fortunate for us, for our force numbered but 300 men with two
pieces of artillery.
The Regiment was out three days on this expedition. It captured,
and brought in, about 25 Rebel soldiers, 50 contrabands, and 100
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