100% found this document useful (4 votes)
31 views

(eBook PDF) Introduction to Java Programming and Data Structures, Comprehensive Version, 11th Global Edition instant download

The document provides information about the eBook 'Introduction to Java Programming and Data Structures, Comprehensive Version, 11th Global Edition' and various related resources available for download. It outlines the organization of the book into five parts covering fundamentals of programming, object-oriented programming, GUI programming, data structures and algorithms, and advanced Java programming. Additionally, it mentions supplementary resources for students and instructors, including online practice tools and video notes.

Uploaded by

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

(eBook PDF) Introduction to Java Programming and Data Structures, Comprehensive Version, 11th Global Edition instant download

The document provides information about the eBook 'Introduction to Java Programming and Data Structures, Comprehensive Version, 11th Global Edition' and various related resources available for download. It outlines the organization of the book into five parts covering fundamentals of programming, object-oriented programming, GUI programming, data structures and algorithms, and advanced Java programming. Additionally, it mentions supplementary resources for students and instructors, including online practice tools and video notes.

Uploaded by

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

(eBook PDF) Introduction to Java Programming and

Data Structures, Comprehensive Version, 11th


Global Edition pdf download

https://ebooksecure.com/product/ebook-pdf-introduction-to-java-
programming-and-data-structures-comprehensive-version-11th-
global-edition/

Download more ebook from https://ebooksecure.com


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

(eBook PDF) Introduction to JAVA Programming and Data


Structures Comprehensive Version 11

http://ebooksecure.com/product/ebook-pdf-introduction-to-java-
programming-and-data-structures-comprehensive-version-11/

(eBook PDF) Introduction to Java Programming, Brief


Version, Global Edition 11th Edition

http://ebooksecure.com/product/ebook-pdf-introduction-to-java-
programming-brief-version-global-edition-11th-edition/

Introduction to Java Programming, Comprehensive Version


10th edition- eBook PDF

https://ebooksecure.com/download/introduction-to-java-
programming-comprehensive-version-ebook-pdf/

(eBook PDF) Java Foundations: Introduction to Program


Design and Data Structures 5th Edition

http://ebooksecure.com/product/ebook-pdf-java-foundations-
introduction-to-program-design-and-data-structures-5th-edition/
(eBook PDF) Data Structures and Abstractions with Java
4th Global Edition

http://ebooksecure.com/product/ebook-pdf-data-structures-and-
abstractions-with-java-4th-global-edition/

(eBook PDF) Data Structures and Abstractions with Java


4th Edition

http://ebooksecure.com/product/ebook-pdf-data-structures-and-
abstractions-with-java-4th-edition/

Data Structures and Abstractions with Java 5th Edition


(eBook PDF)

http://ebooksecure.com/product/data-structures-and-abstractions-
with-java-5th-edition-ebook-pdf/

(eBook PDF) Data Structures and Other Objects Using


Java 4th Edition

http://ebooksecure.com/product/ebook-pdf-data-structures-and-
other-objects-using-java-4th-edition/

(eBook PDF) Data Structures and Problem Solving Using


Java 4th Edition

http://ebooksecure.com/product/ebook-pdf-data-structures-and-
problem-solving-using-java-4th-edition/
6 Preface

Part I: Fundamentals of Part II: Object-Oriented Part III: GUI Programming Part IV: Data Structures and Part V: Advanced Java
Programming Programming Algorithms Ch 16 Programming
Chapter 1 Introduction to Chapter 9 Objects and Classes Chapter 14 JavaFX Basics Ch 7 Chapter 18 Recursion Chapter 32 Multithreading and
Computers, Programs, and Parallel Programming
Java
Chapter 10 Thinking in Objects Chapter 15 Event-Driven Ch 13 Chapter 19 Generics
Programming and Chapter 33 Networking
Chapter 2 Elementary Animations
Chapter 11 Inheritance and Chapter 20 Lists, Stacks, Queues,
Programming
Polymorphism and Priority Queues Chapter 34 Java Database
Chapter 16 JavaFX Controls Programming
Chapter 3 Selections and Multimedia
Chapter 12 Exception Chapter 21 Sets and Maps
Handling and Text I/O Chapter 35 Advanced Database
Chapter 4 Mathematical Chapter 31 Advanced JavaFX Programming
Chapter 22 Developping
Functions, Characters, Chapter 13 Abstract Classes and FXML Efficient Algorithms
and Strings and Interfaces Chapter 36 Internationalization
Chapter 23 Sorting
Chapter 5 Loops Chapter 17 Binary I/O Chapter 37 Servlets
Chapter 24 Implementing Lists,
Chapter 6 Methods Stacks, Queues, and Priority Chapter 38 JavaServer Pages
Queues

Chapter 7 Single-Dimensional Chapter 39 JavaServer Faces


Arrays Chapter 25 Binary Search Trees
Chapter 40 RMI
Note: Chapters 1–18 are in the
Chapter 8 Multidimensional Chapter 26 AVL Trees
brief version of this book.
Arrays Chapter 41 Web Services
Note: Chapters 1–30 are in the Chapter 27 Hashing
comprehensive version.

Note: Chapters 31–44 are bonus Chapter 28 Graphs and


chapters available from the Applications
Companion Website.

Chapter 29 Weighted Graphs


and Applications

Chapter 30 Aggregate Operations


and Collection Streams

Chapter 42 2-4 Trees and B-


Trees

Chapter 43 Red-Black Trees Ch 9 Chapter 44 Testing Using JUnit


Preface  7

Organization of the Book


The chapters can be grouped into five parts that, taken together, form a comprehensive introduc-
tion to Java programming, data structures and algorithms, and database and Web programming.
Because knowledge is cumulative, the early chapters provide the conceptual basis for under-
standing programming and guide students through simple examples and exercises; subsequent
chapters progressively present Java programming in detail, culminating with the development
of comprehensive Java applications. The appendixes contain a mixed bag of topics, including an
introduction to number systems, bitwise operations, regular expressions, and enumerated types.

Part I: Fundamentals of Programming (Chapters 1–8)


The first part of the book is a stepping stone, preparing you to embark on the journey of learning
Java. You will begin to learn about Java (Chapter 1) and fundamental programming t­echniques
with primitive data types, variables, constants, assignments, expressions, and operators (­Chapter 2),
selection statements (Chapter 3), mathematical functions, characters, and strings (Chapter 4), loops
(Chapter 5), methods (Chapter 6), and arrays (Chapters 7–8). After ­Chapter 7, you can jump to
Chapter 18 to learn how to write recursive methods for solving inherently recursive problems.

Part II: Object-Oriented Programming (Chapters 9–13, and 17)


This part introduces object-oriented programming. Java is an object-oriented programming
language that uses abstraction, encapsulation, inheritance, and polymorphism to provide
great flexibility, modularity, and reusability in developing software. You will learn program-
ming with objects and classes (Chapters 9–10), class inheritance (Chapter 11), polymorphism
(­Chapter 11), exception handling (Chapter 12), abstract classes (Chapter 13), and interfaces
(Chapter 13). Text I/O is introduced in Chapter 12 and binary I/O is discussed in Chapter 17.

Part III: GUI Programming (Chapters 14–16 and Bonus Chapter 31)
JavaFX is a new framework for developing Java GUI programs. It is not only useful for
developing GUI programs, but also an excellent pedagogical tool for learning object-oriented
programming. This part introduces Java GUI programming using JavaFX in Chapters 14–16.
Major topics include GUI basics (Chapter 14), container panes (Chapter 14), drawing shapes
(Chapter 14), event-driven programming (Chapter 15), animations (Chapter 15), and GUI
­controls (Chapter 16), and playing audio and video (Chapter 16). You will learn the a­ rchitecture
of JavaFX GUI programming and use the controls, shapes, panes, image, and video to develop
useful applications. Chapter 31 covers advanced features in JavaFX.

Part IV: Data Structures and Algorithms (Chapters 18–30 and Bonus Chapters 42–43)
This part covers the main subjects in a typical data structures and algorithms course. Chapter 18
introduces recursion to write methods for solving inherently recursive problems. Chapter 19 presents
how generics can improve software reliability. Chapters 20 and 21 introduce the Java Collection
Framework, which defines a set of useful API for data structures. Chapter 22 discusses measur-
ing algorithm efficiency in order to choose an appropriate algorithm for applications. Chapter 23
describes classic sorting algorithms. You will learn how to implement several classic data struc-
tures lists, queues, and priority queues in Chapter 24. Chapters 25 and 26 introduce binary search
trees and AVL trees. Chapter 27 presents hashing and implementing maps and sets using hashing.
Chapters 28 and 29 introduce graph applications. Chapter 30 introduces aggregate operations for
collection streams. The 2-4 trees, B-trees, and red-black trees are covered in Bonus Chapters 42–43.

Part V: Advanced Java Programming (Chapters 32-41, 44)


This part of the book is devoted to advanced Java programming. Chapter 32 treats the use of
multithreading to make programs more responsive and interactive and introduces parallel pro-
gramming. Chapter 33 discusses how to write programs that talk with each other from different
8 Preface
hosts over the Internet. Chapter 34 introduces the use of Java to develop database projects.
Chapter 35 delves into advanced Java database programming. Chapter 36 covers the use of
internationalization support to develop projects for international audiences. Chapters 37 and
38 introduce how to use Java servlets and JavaServer Pages to generate dynamic content from
Web servers. Chapter 39 introduces modern Web application development using JavaServer
Faces. Chapter 40 introduces remote method invocation and Chapter 41 discusses Web ser-
vices. Chapter 44 introduces testing Java programs using JUnit.

Appendixes
This part of the book covers a mixed bag of topics. Appendix A lists Java keywords. ­Appendix B
gives tables of ASCII characters and their associated codes in decimal and in hex. Appen-
dix C shows the operator precedence. Appendix D summarizes Java modifiers and their usage.
Appendix E discusses special floating-point values. Appendix F introduces number systems and
conversions among binary, decimal, and hex numbers. Finally, Appendix G introduces bitwise
operations. Appendix H introduces regular expressions. Appendix I covers enumerated types.

Java Development Tools


You can use a text editor, such as the Windows Notepad or WordPad, to create Java programs
and to compile and run the programs from the command window. You can also use a Java
development tool, such as NetBeans or Eclipse. These tools support an integrated develop-
ment environment (IDE) for developing Java programs quickly. Editing, compiling, building,
executing, and debugging programs are integrated in one graphical user interface. Using these
tools effectively can greatly increase your programming productivity. NetBeans and Eclipse
IDE tutorials are easy to use if you follow the tutorials. Tutorials on NetBeans and Eclipse can be found in
the supplements on the Companion Website www.pearsonglobaleditions.com/Liang.

Student Resources
The Companion Website (www.pearsonglobaleditions.com/Liang) contains the following
resources:
■■ Answers to CheckPoint questions
■■ Solutions to majority of even-numbered programming exercises
■■ Source code for the examples in the book
■■ Interactive quiz (organized by sections for each chapter)
■■ Supplements
■■ Debugging tips
■■ Video notes
■■ Algorithm animations

Supplements
The text covers the essential subjects. The supplements extend the text to introduce additional
topics that might be of interest to readers. The supplements are available from the Companion
Website.
Preface  9

Instructor Resources
The Companion Website, accessible from www.pearsonglobaleditions.com/Liang, contains the
following resources:
■■ Microsoft PowerPoint slides with interactive buttons to view full-color, syntax-highlighted
source code and to run programs without leaving the slides.
■■ Solutions to a majority of odd-numbered programming exercises.
■■ More than 200 additional programming exercises and 300 quizzes organized by ­chapters.
These exercises and quizzes are available only to the instructors. Solutions to these
­exercises and quizzes are provided.
■■ Web-based quiz generator. (Instructors can choose chapters to generate quizzes from a
large database of more than two thousand questions.)
■■ Sample exams. Most exams have four parts:
■■ Multiple-choice questions or short-answer questions
■■ Correct programming errors
■■ Trace programs
■■ Write programs
■■ Sample exams with ABET course assessment.
■■ Projects. In general, each project gives a description and asks students to analyze, design,
and implement the project.
Some readers have requested the materials from the Instructor Resource Center. Please
understand that these are for instructors only. Such requests will not be answered.

Online Practice and Assessment


with MyProgrammingLab
MyProgrammingLab helps students fully grasp the logic, semantics, and syntax of program-
ming. Through practice exercises and immediate, personalized feedback, MyProgrammingLab
improves the programming competence of beginning students who often struggle with the
basic concepts and paradigms of popular high-level programming languages.
A self-study and homework tool, a MyProgrammingLab course consists of hundreds of small
practice problems organized around the structure of this textbook. For students, the system auto-
matically detects errors in the logic and syntax of their code submissions and offers targeted hints
that enable students to figure out what went wrong—and why. For instructors, a comprehensive
gradebook tracks correct and incorrect answers and stores the code inputted by students for review.
MyProgrammingLab is offered to users of this book in partnership with Turing’s Craft, the
makers of the CodeLab interactive programming exercise system. For a full demonstration,
to see feedback from instructors and students, or to get started using MyProgrammingLab in
your course, visit www.myprogramminglab.com.

Video Notes
We are excited about the new Video Notes feature that is found in this new edition. These VideoNote

videos provide additional help by presenting examples of key topics and showing how
to solve problems completely from design through coding. Video Notes are available from
www.pearsonglobaleditions.com/Liang.
10 Preface

Algorithm Animations
Animation We have provided numerous animations for algorithms. These are valuable pedagogical tools
to demonstrate how algorithms work. Algorithm animations can be accessed from the Com-
panion Website.

Acknowledgments
I would like to thank Armstrong State University for enabling me to teach what I write and for
supporting me in writing what I teach. Teaching is the source of inspiration for continuing to
improve the book. I am grateful to the instructors and students who have offered comments,
suggestions, corrections, and praise. My special thanks go to Stefan Andrei of Lamar Univer-
sity and William Bahn of University of Colorado Colorado Springs for their help to improve
the data structures part of this book.
This book has been greatly enhanced thanks to outstanding reviews for this and previous edi-
tions. The reviewers are: Elizabeth Adams (James Madison University), Syed Ahmed (North
­Georgia College and State University), Omar Aldawud (Illinois Institute of Technology), Ste-
fan Andrei (Lamar University), Yang Ang (University of Wollongong, Australia), Kevin Bierre
(Rochester Institute of Technology), Aaron Braskin (Mira Costa High School), David Champion
(DeVry Institute), James Chegwidden (Tarrant County College), Anup Dargar (University of North
Dakota), Daryl Detrick (Warren Hills Regional High School), Charles Dierbach (Towson Univer-
sity), Frank Ducrest (University of Louisiana at Lafayette), Erica Eddy (University of Wisconsin at
Parkside), Summer Ehresman (Center Grove High School), Deena Engel (New York University),
Henry A. Etlinger (Rochester Institute of Technology), James Ten Eyck (Marist College), Myers
Foreman (Lamar University), Olac Fuentes (University of Texas at El Paso), Edward F. Gehringer
(North Carolina State University), Harold Grossman (Clemson University), Barbara Guillot (Loui-
siana State University), Stuart Hansen (University of Wisconsin, Parkside), Dan Harvey (Southern
Oregon University), Ron Hofman (Red River College, Canada), Stephen Hughes (Roanoke Col-
lege), Vladan Jovanovic (Georgia Southern University), Deborah Kabura Kariuki (Stony Point
High School), Edwin Kay (Lehigh University), Larry King (University of Texas at Dallas), Nana
Kofi (Langara College, Canada), George Koutsogiannakis (Illinois Institute of Technology), Roger
Kraft (Purdue University at Calumet), Norman Krumpe (Miami University), Hong Lin (DeVry
Institute), Dan Lipsa (Armstrong State University), James Madison (Rensselaer Polytechnic Insti-
tute), Frank Malinowski (Darton College), Tim Margush (University of Akron), Debbie Masada
(Sun Microsystems), Blayne Mayfield (Oklahoma State University), John McGrath (J.P. McGrath
Consulting), Hugh McGuire (Grand Valley State), Shyamal Mitra (University of Texas at Austin),
Michel Mitri (James Madison University), Kenrick Mock (University of Alaska Anchorage), Frank
Murgolo (California State University, Long Beach), Jun Ni (University of Iowa), Benjamin N ­ ystuen
(University of Colorado at Colorado Springs), Maureen Opkins (CA State University, Long Beach),
Gavin Osborne (University of Saskatchewan), Kevin Parker (Idaho State University), Dale Par-
son (Kutztown University), Mark Pendergast (Florida Gulf Coast University), Richard Povinelli
(Marquette University), Roger Priebe (University of Texas at Austin), Mary Ann Pumphrey (De
Anza Junior College), Pat Roth (Southern Polytechnic State University), Amr Sabry (Indiana Uni-
versity), Ben Setzer (Kennesaw State University), Carolyn Schauble (Colorado State University),
David Scuse (University of Manitoba), Ashraf Shirani (San Jose State University), Daniel Spiegel
(Kutztown University), Joslyn A. Smith (Florida Atlantic University), Lixin Tao (Pace University),
Ronald F. Taylor (Wright State University), Russ Tront (Simon Fraser University), Deborah ­Trytten
(University of Oklahoma), Michael Verdicchio (Citadel), Kent Vidrine (George Washington Uni-
versity), and Bahram Zartoshty (California State University at Northridge).
It is a great pleasure, honor, and privilege to work with Pearson. I would like to thank Tracy
Johnson and her colleagues Marcia Horton, Demetrius Hall, Yvonne Vannatta, Kristy Alaura,
Carole Snyder, Scott Disanno, Bob Engelhardt, Shylaja Gattupalli, and their colleagues for
organizing, producing, and promoting this project.
As always, I am indebted to my wife, Samantha, for her love, support, and encouragement.
Preface  11

Acknowledgments for the Global Edition


Pearson would like to thank and acknowledge Yvan Maillot (Univresite Haute-Alsace) and
Steven Yuwono (National ­University of Singapore) for contributing to this Global Edition,
and Arif Ahmed (National Institute of Technology, ­Silchar), Annette Bieniusa (University of
Kaiserslautern), Shaligram Prajapat (Devi Ahilya Vishwavidyalaya, Indore), and Ram Gopal
Raj (University of Malaya) for reviewing this Global Edition.
CONTENTS
Chapter 1 I ntroduction to Computers,
­Programs, and Java™ 23
1.1 Introduction 24
1.2 What Is a Computer? 24
1.3 Programming Languages 29
1.4 Operating Systems 31
1.5 Java, the World Wide Web, and Beyond 32
1.6 The Java Language Specification, API, JDK,
JRE, and IDE 33
1.7 A Simple Java Program 34
1.8 Creating, Compiling, and Executing a Java Program 37
1.9 Programming Style and Documentation 40
1.10 Programming Errors 42
1.11 Developing Java Programs Using NetBeans 45
1.12 Developing Java Programs Using Eclipse 47

Chapter 2 Elementary Programming 55


2.1 Introduction 56
2.2 Writing a Simple Program 56
2.3 Reading Input from the Console 59
2.4 Identifiers 62
2.5 Variables 62
2.6 Assignment Statements and Assignment Expressions 64
2.7 Named Constants 65
2.8 Naming Conventions 66
2.9 Numeric Data Types and Operations 67
2.10 Numeric Literals 70
2.11 Evaluating Expressions and Operator Precedence 72
2.12 Case Study: Displaying the Current Time 74
2.13 Augmented Assignment Operators 76
2.14 Increment and Decrement Operators 77
2.15 Numeric Type Conversions 79
2.16 Software Development Process 81
2.17 Case Study: Counting Monetary Units 85
2.18 Common Errors and Pitfalls 87

Chapter 3 Selections 97
3.1 Introduction 98
3.2 boolean Data Type 98
3.3 if Statements 100
3.4 Two-Way if-else Statements 102
3.5 Nested if and Multi-Way if-else Statements 103
3.6 Common Errors and Pitfalls 105
3.7 Generating Random Numbers 109
3.8 Case Study: Computing Body Mass Index 111
3.9 Case Study: Computing Taxes 112
3.10 Logical Operators 115
3.11 Case Study: Determining Leap Year 119
3.12 Case Study: Lottery 120
3.13 switch Statements 122
12
Contents  13
3.14 Conditional Operators 125
3.15 Operator Precedence and Associativity 126
3.16 Debugging 128

Chapter 4 Mathematical Functions,


Characters, and Strings 141
4.1 Introduction 142
4.2 Common Mathematical Functions 142
4.3 Character Data Type and Operations 147
4.4 The String Type 152
4.5 Case Studies 161
4.6 Formatting Console Output 167

Chapter 5 Loops 181


5.1 Introduction 182
5.2 The while Loop 182
5.3 Case Study: Guessing Numbers 185
5.4 Loop Design Strategies 188
5.5 Controlling a Loop with User Confirmation or a Sentinel Value 190
5.6 The do-while Loop 192
5.7 The for Loop 195
5.8 Which Loop to Use? 198
5.9 Nested Loops 200
5.10 Minimizing Numeric Errors 202
5.11 Case Studies 204
5.12 Keywords break and continue 208
5.13 Case Study: Checking Palindromes 211
5.14 Case Study: Displaying Prime Numbers 213

Chapter 6 Methods 227


6.1 Introduction 228
6.2 Defining a Method 228
6.3 Calling a Method 230
6.4 void vs. Value-Returning Methods 233
6.5 Passing Parameters by Values 236
6.6 Modularizing Code 239
6.7 Case Study: Converting Hexadecimals to Decimals 241
6.8 Overloading Methods 243
6.9 The Scope of Variables 246
6.10 Case Study: Generating Random Characters 247
6.11 Method Abstraction and Stepwise Refinement 249

Chapter 7 Single-Dimensional Arrays 269


7.1 Introduction 270
7.2 Array Basics 270
7.3 Case Study: Analyzing Numbers 277
7.4 Case Study: Deck of Cards 278
7.5 Copying Arrays 280
7.6 Passing Arrays to Methods 281
7.7 Returning an Array from a Method 284
7.8 Case Study: Counting the Occurrences of Each Letter 285
7.9 Variable-Length Argument Lists 288
7.10 Searching Arrays 289
7.11 Sorting Arrays 293
14 Contents
7.12 The Arrays Class 294
7.13 Command-Line Arguments 296

Chapter 8 Multidimensional Arrays 311


8.1 Introduction 312
8.2 Two-Dimensional Array Basics 312
8.3 Processing Two-Dimensional Arrays 315
8.4 Passing Two-Dimensional Arrays to Methods 317
8.5 Case Study: Grading a Multiple-Choice Test 318
8.6 Case Study: Finding the Closest Pair 320
8.7 Case Study: Sudoku 322
8.8 Multidimensional Arrays 325

Chapter 9 Objects and Classes 345


9.1 Introduction 346
9.2 Defining Classes for Objects 346
9.3 Example: Defining Classes and Creating Objects 348
9.4 Constructing Objects Using Constructors 353
9.5 Accessing Objects via Reference Variables 354
9.6 Using Classes from the Java Library 358
9.7 Static Variables, Constants, and Methods 361
9.8 Visibility Modifiers 366
9.9 Data Field Encapsulation 368
9.10 Passing Objects to Methods 371
9.11 Array of Objects 375
9.12 Immutable Objects and Classes 377
9.13 The Scope of Variables 379
9.14 The this Reference 380

Chapter 10 Object-Oriented Thinking 389


10.1 Introduction 390
10.2 Class Abstraction and Encapsulation 390
10.3 Thinking in Objects 394
10.4 Class Relationships 397
10.5 Case Study: Designing the Course Class 400
10.6 Case Study: Designing a Class for Stacks 402
10.7 Processing Primitive Data Type Values as Objects 404
10.8 Automatic Conversion between Primitive Types
and Wrapper Class Types 407
10.9 The BigInteger and BigDecimal Classes 408
10.10 The String Class 410
10.11 The StringBuilder and StringBuffer Classes 416

Chapter 11 Inheritance and


Polymorphism 433
11.1 Introduction 434
11.2 Superclasses and Subclasses 434
11.3 Using the super Keyword 440
11.4 Overriding Methods 443
11.5 Overriding vs. Overloading 444
11.6 The Object Class and Its toString() Method 446
11.7 Polymorphism 447
11.8 Dynamic Binding 447
11.9 Casting Objects and the instanceof Operator 451
11.10 The Object’s equals Method 455
Contents  15
11.11 The ArrayList Class 456
11.12 Useful Methods for Lists 462
11.13 Case Study: A Custom Stack Class 463
11.14 The protected Data and Methods 464
11.15 Preventing Extending and Overriding 467

Chapter 12 Exception Handling


and Text I/O 475
12.1 Introduction 476
12.2 Exception-Handling Overview 476
12.3 Exception Types 481
12.4 More on Exception Handling 484
12.5 The finally Clause 492
12.6 When to Use Exceptions 493
12.7 Rethrowing Exceptions 494
12.8 Chained Exceptions 495
12.9 Defining Custom Exception Classes 496
12.10 The File Class 499
12.11 File Input and Output 502
12.12 Reading Data from the Web 508
12.13 Case Study: Web Crawler 510

Chapter 13 Abstract Classes and Interfaces 521


13.1 Introduction 522
13.2 Abstract Classes 522
13.3 Case Study: the Abstract Number Class 527
13.4 Case Study: Calendar and GregorianCalendar 529
13.5 Interfaces 532
13.6 The Comparable Interface 535
13.7 The Cloneable Interface 540
13.8 Interfaces vs. Abstract Classes 545
13.9 Case Study: The Rational Class 548
13.10 Class-Design Guidelines 553

Chapter 14 JavaFX Basics 563


14.1 Introduction 564
14.2 JavaFX vs Swing and AWT 564
14.3 The Basic Structure of a JavaFX Program 564
14.4 Panes, Groups, UI Controls, and Shapes 567
14.5 Property Binding 570
14.6 Common Properties and Methods for Nodes 573
14.7 The Color Class 575
14.8 The Font Class 576
14.9 The Image and ImageView Classes 578
14.10 Layout Panes and Groups 580
14.11 Shapes 589
14.12 Case Study: The ClockPane Class 602

Chapter 15 Event-Driven Programming


and Animations 615
15.1 Introduction 616
15.2 Events and Event Sources 618
15.3 Registering Handlers and Handling Events 619
15.4 Inner Classes 623
15.5 Anonymous Inner Class Handlers 624
16 Contents
15.6 Simplifying Event Handling Using Lambda Expressions 627
15.7 Case Study: Loan Calculator 631
15.8 Mouse Events 633
15.9 Key Events 635
15.10 Listeners for Observable Objects 638
15.11 Animation 640
15.12 Case Study: Bouncing Ball 648
15.13 Case Study: US Map 652

Chapter 16 JavaFX UI Controls


and Multimedia 665
16.1 Introduction 666
16.2 Labeled and Label 666
16.3 Button 668
16.4 CheckBox 670
16.5 RadioButton 673
16.6 TextField 676
16.7 TextArea 677
16.8 ComboBox 681
16.9 ListView 684
16.10 ScrollBar 687
16.11 Slider 690
16.12 Case Study: Developing a Tic-Tac-Toe Game 693
16.13 Video and Audio 698
16.14 Case Study: National Flags and Anthems 701

Chapter 17 Binary I/O 713


17.1 Introduction 714
17.2 How Is Text I/O Handled in Java? 714
17.3 Text I/O vs. Binary I/O 715
17.4 Binary I/O Classes 716
17.5 Case Study: Copying Files 726
17.6 Object I/O 728
17.7 Random-Access Files 733

Chapter 18 Recursion 741


18.1 Introduction 742
18.2 Case Study: Computing Factorials 742
18.3 Case Study: Computing Fibonacci
Numbers 745
18.4 Problem Solving Using Recursion 748
18.5 Recursive Helper Methods 750
18.6 Case Study: Finding the Directory Size 753
18.7 Case Study: Tower of Hanoi 755
18.8 Case Study: Fractals 758
18.9 Recursion vs. Iteration 762
18.10 Tail Recursion 762

Chapter 19 Generics 773


19.1 Introduction 774
19.2 Motivations and Benefits 774
19.3 Defining Generic Classes and Interfaces 776
19.4 Generic Methods 778
19.5 Case Study: Sorting an Array of Objects 780
Contents  17
19.6 Raw Types and Backward Compatibility 782
19.7 Wildcard Generic Types 783
19.8 Erasure and Restrictions on Generics 786
19.9 Case Study: Generic Matrix Class 788

Chapter 20 L
 ists, Stacks, Queues, and
Priority Queues 797
20.1 Introduction 798
20.2 Collections 798
20.3 Iterators 802
20.4 Using the forEach Method 803
20.5 Lists 804
20.6 The Comparator Interface 809
20.7 Static Methods for Lists and Collections 813
20.8 Case Study: Bouncing Balls 816
20.9 Vector and Stack Classes 820
20.10 Queues and Priority Queues 821
20.11 Case Study: Evaluating Expressions 825

Chapter 21 Sets and Maps 837


21.1 Introduction 838
21.2 Sets 838
21.3 Comparing the Performance of Sets and Lists 846
21.4 Case Study: Counting Keywords 849
21.5 Maps 850
21.6 Case Study: Occurrences of Words 855
21.7 Singleton and Unmodifiable Collections and Maps 857

Chapter 22 Developing Efficient


Algorithms 861
22.1 Introduction 862
22.2 Measuring Algorithm Efficiency Using Big O Notation 862
22.3 Examples: Determining Big O 864
22.4 Analyzing Algorithm Time Complexity 868
22.5 Finding Fibonacci Numbers Using Dynamic
Programming 871
22.6 Finding Greatest Common Divisors Using Euclid’s
Algorithm 873
22.7 Efficient Algorithms for Finding Prime Numbers 877
22.8 Finding the Closest Pair of Points Using
Divide-and-Conquer 883
22.9 Solving the Eight Queens Problem Using Backtracking 886
22.10 Computational Geometry: Finding a Convex Hull 889

Chapter 23 Sorting 903


23.1 Introduction 904
23.2 Insertion Sort 904
23.3 Bubble Sort 906
23.4 Merge Sort 909
23.5 Quick Sort 912
23.6 Heap Sort 916
23.7 Bucket and Radix Sorts 923
23.8 External Sort 925
18 Contents

Chapter 24 I mplementing Lists, Stacks,


Queues, and Priority Queues 939
24.1 Introduction 940
24.2 Common Operations for Lists 940
24.3 Array Lists 944
24.4 Linked Lists 951
24.5 Stacks and Queues 965
24.6 Priority Queues 969

Chapter 25 Binary Search Trees 975


25.1 Introduction 976
25.2 Binary Search Trees 976
25.3 Deleting Elements from a BST 989
25.4 Tree Visualization and MVC 995
25.5 Iterators 998
25.6 Case Study: Data Compression 1000

Chapter 26 AVL Trees 1011


26.1 Introduction 1012
26.2 Rebalancing Trees 1012
26.3 Designing Classes for AVL Trees 1015
26.4 Overriding the insert Method 1016
26.5 Implementing Rotations 1017
26.6 Implementing the delete Method 1018
26.7 The AVLTree Class 1018
26.8 Testing the AVLTree Class 1024
26.9 AVL Tree Time Complexity Analysis 1027

Chapter 27 Hashing 1031


27.1 Introduction 1032
27.2 What Is Hashing? 1032
27.3 Hash Functions and Hash Codes 1033
27.4 Handling Collisions Using Open Addressing 1035
27.5 Handling Collisions Using Separate Chaining 1039
27.6 Load Factor and Rehashing 1039
27.7 Implementing a Map Using Hashing 1041
27.8 Implementing Set Using Hashing 1050

Chapter 28 Graphs and Applications 1061


28.1 Introduction 1062
28.2 Basic Graph Terminologies 1063
28.3 Representing Graphs 1064
28.4 Modeling Graphs 1070
28.5 Graph Visualization 1080
28.6 Graph Traversals 1083
28.7 Depth-First Search (DFS) 1084
28.8 Case Study: The Connected Circles Problem 1088
28.9 Breadth-First Search (BFS) 1090
28.10 Case Study: The Nine Tails Problem 1093
Contents  19

Chapter 29 W
 eighted Graphs and
Applications 1107
29.1 Introduction 1108
29.2 Representing Weighted Graphs 1109
29.3 The WeightedGraph Class 1111
29.4 Minimum Spanning Trees 1119
29.5 Finding Shortest Paths 1125
29.6 Case Study: The Weighted Nine Tails Problem 1134

Chapter 30 
Aggregate Operations
for Collection Streams 1145
30.1 Introduction 1146
30.2 Stream Pipelines 1146
30.3 IntStream, LongStream, and DoubleStream 1152
30.4 Parallel Streams 1155
30.5 Stream Reduction Using the reduce Method 1157
30.6 Stream Reduction Using the collect Method 1160
30.7 Grouping Elements Using the groupingby Collector 1163
30.8 Case Studies 1166

Chapter 31–44 are available from the Companion Website at


www.pearsonglobaleditions.com/Liang

Chapter 31 Advanced JavaFX and FXML


Chapter 32 Multithreading and Parallel
Programming
Chapter 33 Networking
Chapter 34 Java Database Programming
Chapter 35 Advanced Java Database Programming
Chapter 36 Internationalization
Chapter 37 Servlets
Chapter 38 JavaServer Pages
Chapter 39 JavaServer Faces
Chapter 40 Remote Method Invocation
Chapter 41 Web Services
Chapter 42 2-4 Trees and B-Trees
Chapter 43 Red-Black Trees
Chapter 44 Testing Using JUnit
20 Contents

Appendixes 1177
Appendix A Java Keywords 1179
Appendix B The ASCII Character Set 1180
Appendix C Operator Precedence Chart 1182
Appendix D Java Modifiers 1184
Appendix E Special Floating-Point Values 1186
Appendix F Number Systems 1187
Appendix G Bitwise Operations 1191
Appendix H Regular Expressions 1192
Appendix I Enumerated Types 1197

Quick Reference 1203


Index 1205
VideoNotes
Locations of VideoNotes
VideoNote
www.pearsonglobaleditions.com/Liang

Chapter 1 Introduction to Computers, Programs, Coupon collector’s problem 304


and Java™ 23 Consecutive four 306
Your first Java program 34
Compile and run a Java program 39 Chapter 8 Multidimensional Arrays 311
NetBeans brief tutorial 45 Find the row with the largest sum 316
Eclipse brief tutorial 47 Grade multiple-choice test 318
Sudoku 322
Chapter 2 Elementary Programming 55 Multiply two matrices 331
Obtain input 59 Even number of 1s 338
Use operators / and % 74
Software development Chapter 9 Objects and Classes 345
process 81 Define classes and objects 346
Compute loan payments 82 Use classes 358
Compute BMI 94 Static vs. instance 361
Data field encapsulation 368
Chapter 3 Selections 97 The this keyword 380
Program addition quiz 99 The Fan class 386
Program subtraction quiz 109
Use multi-way if-else Chapter 10 Object-Oriented Thinking 389
statements 112 The Loan class 391
Sort three integers 132 The BMI class 394
Check point location 134 The StackOfIntegers class 402
Process large numbers 408
Chapter 4 Mathematical Functions, Characters, The String class 410
and Strings 141 The MyPoint class 424
Introduce Math functions 142
Introduce strings and objects 152 Chapter 11 Inheritance and Polymorphism 433
Convert hex to decimal 165 Geometric class hierarchy 434
Compute great circle distance 173 Polymorphism and dynamic
Convert hex to binary 176 binding demo 448
The ArrayList class 456
Chapter 5 Loops 181 The MyStack class 463
Use while loop 182 New Account class 470
Guess a number 185
Multiple subtraction quiz 188 Chapter 12 Exception Handling and Text I/O 475
Use do-while loop 192 Exception-handling advantages 476
Minimize numeric errors 202 Create custom exception classes 496
Display loan schedule 219 Write and read data 502
Sum a series 220 HexFormatException 515

Chapter 6 Methods 227 Chapter 13 Abstract Classes and Interfaces 521


Define/invoke max method 230 Abstract GeometricObject class 522
Use void method 233 Calendar and Gregorian
Modularize code 239 Calendar classes 529
Stepwise refinement 249 The concept of interface 532
Reverse an integer 258 Redesign the Rectangle class 558
Estimate p 261
Chapter 14 JavaFX Basics 563
Chapter 7 Single-Dimensional Arrays 269 Getting started with JavaFX 564
Random shuffling 274 Understand property binding 570
Deck of cards 278 Use Image and ImageView 578
Selection sort 293 Use layout panes 580
Command-line arguments 297 Use shapes 589
21
22 VideoNotes
Display a tic-tac-toe board 608 Tic-Tac-Toe 693
Display a bar chart 610 Use Media, MediaPlayer,
and MediaView 698
Chapter 15 Event-Driven Programming Use radio buttons and text fields 705
and Animations 615 Set fonts 707
Handler and its registration 622
Anonymous handler 625 Chapter 17 Binary I/O 713
Move message using the Copy file 726
mouse 634 Object I/O 728
Animate a rising flag 640 Split a large file 738
Flashing text 646
Simple calculator 656 Chapter 18 Recursion 741
Check mouse-point location 658 Binary search 752
Display a running fan 661 Directory size 753
Fractal (Sierpinski triangle) 758
Chapter 16 JavaFX UI Controls and Multimedia 665 Search a string in a directory 769
Use ListView 684 Recursive tree 772
Use Slider 690

Animations

Chapter 7 Single-Dimensional Arrays 269 radix sort on Companion


linear search animation on Website 924
Companion Website 290
binary search animation on Chapter 24 Implementing Lists, Stacks,
Companion Website 290 Queues, and Priority Queues 939
selection sort animation on list animation on Companion
Companion Website 293 Website 940
stack and queue animation on
Chapter 8 Multidimensional Arrays 311 Companion Website 965
closest-pair animation on
the Companion Website 320 Chapter 25 Binary Search Trees 975
BST animation on
Chapter 22 Developing Efficient Algorithms 861 Companion Website 976
binary search animation on
the Companion Website 868 Chapter 26 AVL Trees 1011
selection sort animation on AVL tree animation on
the Companion Website 868 Companion Website 1012
closest-pair animation on
Companion Website 883 Chapter 27 Hashing 1031
Eight Queens animation on linear probing animation on
the Companion Website 886 Companion Website 1036
convex hull animation on quadratic probing animation on
the Companion Website 889 Companion Website 1037
separate chaining animation on
Chapter 23 Sorting 903 Companion Website 1040
insertion-sort animation on
Companion Website 904 Chapter 28 Graphs and Applications 1061
bubble sort animation on the graph learning tool on
Companion Website 907 Companion Website 1064
merge animation on Companion U.S. Map Search 1086
Website 911 Chapter 29 Weighted Graphs and
partition animation on Applications 1107
Companion Website 915 weighted graph learning tool
heap animation on Companion animation on Companion Website 1108
Website 917
Chapter

1
Introduction
to Computers,
Programs, and Java™
Objectives
■■ To understand computer basics, programs, and operating systems
(§§1.2–1.4).
■■ To describe the relationship between Java and the World Wide Web
(§1.5).
■■ To understand the meaning of Java language specification, API, JDK™,
JRE™, and IDE (§1.6).
■■ To write a simple Java program (§1.7).
■■ To display output on the console (§1.7).
■■ To explain the basic syntax of a Java program (§1.7).
■■ To create, compile, and run Java programs (§1.8).
■■ To use sound Java programming style and document programs properly
(§1.9).
■■ To explain the differences between syntax errors, runtime errors, and
logic errors (§1.10).
■■ To develop Java programs using NetBeans™ (§1.11).
■■ To develop Java programs using Eclipse™ (§1.12).
Another Random Scribd Document
with Unrelated Content
country. A hospital has been provided by the charity of the natives in
the village of St. Cyprien where the sick are gratuitously attended.
THE INDIANS.

—Captain Pratt of the Indian Training School at Carlisle Barracks, has


persuaded the apprentice boys who are earning money to deposit it
in the bank, and forty-seven of them have opened an account. An
excellent suggestion for pale faces as well.
—More than nine-tenths of the Indians in the United States are
peaceably cultivating their farms, and sending their sons and
daughters to the Government schools, East and West. The
disturbance, therefore, made by one tribe of the most wild and
untamed Indians in the country will not particularly discourage or
alarm those who have been watching the admirable Peace Policy of
the Government. A little more patience and perseverance in the right
direction would soon overcome what remains of hostility among
these wards of the Nation.
—The liberality of the Indians at White Earth Reservation is testified
to by Bishop Whipple, who recently visited the Episcopal mission at
that point. He says that in taking the offerings, every man, woman
and child came up and deposited the gift in the alms basin. The
Bishop also speaks encouragingly of the religious work carried on at
Red Lake, where there is a flourishing Indian church, whereas three
years ago there was not a single member. Five miles farther up the
Lake, more than half the Indians are Christians, and these have
been baptized within the past three years. The Indian chief, who is
an exemplary Christian and one of the noblest specimens of his race,
has had much to do in bringing about this wonderful change.
THE CHINESE.

—The Japanese colony in Paris are about to erect a pagoda for their
religious devotions.
—The Governor of Foo Chow has issued a proclamation calling upon
the people not to molest the missionaries or the converts who follow
them, either at their chapels or school-houses.
—Out of one party of twenty-five Chinese students, who are
returning to their homes, it is said that nine have changed their
religious faith since they came to this country.
—It is reported that as fifty of the Chinese students ordered home
by their Government were leaving the San Francisco wharf,
September 6th, they joined in singing our National hymn, “My
country, ’tis of thee.”
—The American Board has published a new map of Japan about 2½
by 4½ feet in size, which will be found a valuable aid in missionary
concerts. The price of the map on fine paper is 40 cents, and on
cloth 70 cents.
—It is reported that the high Chinese authorities are in favor of an
International Exhibition at Shanghai in 1882. Twenty-two thousand
applications for space have been received from American and
European manufacturers, and if the Exhibition is determined upon,
there is little doubt of its success, both in a political and an industrial
point of view.
THE FREEDMEN.
REV. JOSEPH E. ROY, D.D., Field Superintendent, Atlanta, Ga.

SUMMER REVIVALS.

McLEANSVILLE, N.C.

The first Sabbath of September we began a series of meetings,


assisted by Rev. Geo. S. Smith and Rev. Mr. Turner, of Raleigh. On
the Sabbath the house would not hold the congregation. Quite a
number came from ten to twelve miles, a few from twenty to
twenty-five miles.
Many white people attended every night meeting. Indeed, more
white people attended the services than had ever attended any one
meeting here since the church was built. A number of them have
expressed themselves well pleased with the preaching.
Seven persons, two of them pupils in our Normal School, professed
faith in Christ. We think the influence on the community, both white
and colored, has been good.
SAVANNAH, GA.

My work in Savannah, as supply, during the summer, was greatly


blessed of the Lord. For nearly two months my efforts were to
become acquainted with the church and people in general, and in
the meantime we were preparing our hearts for the ingathering of
precious souls. On Monday night, July 18th, we began a series of
meetings for the unconverted. They continued about three weeks,
during which time thirty confessed Christ. Most of these, we believe,
were hopefully converted. Three or four of those who sought Christ
in the meetings have been brought out into the light of a dear
Saviour since the meetings closed; thus making the number more
than thirty. Seventeen united with us, and a few more will come in
at the next communion. Some, of course, joined other churches with
their parents or friends. We held a young convert’s meeting each
week from the close of the protracted meeting to the last of
September, when I left for school. There was nothing to me more
cheering than to listen to the simple child-like prayers and talks of
the young converts in their meetings. The youngest are three little
girls who are respectively about nine, eleven and twelve years old.
They are always at their post, and it is hoped that their Christian
lives will be long and active.
McINTOSH, CYPRESS SLASH, GA.

In my last letter I informed you of the extra series of meetings we


were having. We continued our protracted efforts for two weeks.
Now we have the grand result. On last Sabbath I baptized twelve
hopeful converts, and four were added on profession; all of these
are adults. Sixteen hopeful young men and women have been added
to the church within the last two weeks. God has greatly blessed us
in our efforts to build up His kingdom, for which we give many
thanks, and are very greatly encouraged. Pray for us that others
may be added, such as shall be saved.
TALLADEGA, ALA.

Our series of meetings began on the first Sabbath in September, and


at the first invitation offered to the unconverted, at the 11 o’clock
service, five came forward inquiring the way of life, and strange to
say, each of that five was hopefully converted before the next
Sabbath. There were several other inquirers during that week, but
on account of repairs to the chapel, we were obliged to close our
meetings on Tuesday of the next week. Eleven united with our
church—six on profession, and five by letter. Not being ordained, it
was necessary that I should get some other minister to perform the
baptism and administer the Lord’s Supper. Elder Shuford, in charge
of the Methodist church in this place, aided me, and the work was
accomplished.
ANNISTON, ALA.

The revival work commenced in our county the middle of July. Since
that date several churches of different denominations have been
carrying on revival meetings. All, more or less, have rejoiced over
the ingathering of souls.
Even our own little church has felt the visitation of the Holy Ghost
and witnessed the gathering in of the sheaves into the Master’s
store-house. We began our meetings two weeks ago. The first week
we carried on a woman’s prayer meeting. The subject was, “That the
church might lay aside every weight and sin, which doth so easily
beset, and labor for the conversion of souls.” These meetings did a
great deal of good, for when the meetings proper began, the church
was ready to enter upon the Master’s work, which it did with great
earnestness. The meetings closed with eight conversions. All united
with us save one. Others are anxiously seeking for the blessed
Master. There was an expression of great joy among my people to
know that they had seven more to come around the Lord’s table and
take with us the emblems of our Lord’s broken body and shed blood.
LAWSONVILLE AND THE COVE.

The church at Lawsonville has been blessed with a revival. There


were seven conversions and four accessions to the church. At the
Cove we enjoyed a revival season in which there were seven
conversions and three accessions. The meetings did great good in
reviving professed Christians, and bringing parties out of the path of
the church to a realization of their responsibilities to God and society.
I visited and assisted Bro. Snell at Kingston during a revival at that
place, in which there were several conversions prior to my leaving,
among which were four white men of respectability in that
community. I have just returned home from a revival at my former
station, Anniston, where much good was done in reviving the
church, and turning some seven or eight souls from the error of their
ways.
CHILDERSBURG, ALA.

We commenced our summer series of meetings on the fourth


Wednesday night in July. On the Sabbath we had a great gathering.
In the afternoon prayer meeting, every body seemed to be deeply
impressed with the spirit of the Lord, and at night many came
forward for prayers. The house was full all day and at night. About
two o’clock I was awakened by the alarm of fire, and one of my
members rapped at the door and said, “Our church is on fire!” I rose
to my feet and reached the church just as it was falling in.
We came down to the Baptist church and continued our meetings.
Many took a stand for the Lord and joined our church. After my
meetings were over, I helped others. At Shelby Iron Works twelve or
fifteen gave their hearts to the Lord, and at Talladega the meetings
were very interesting and profitable.
NASHVILLE, TENN.

On the first Sabbath of the month a revival began and continued for
two weeks. Our meetings were large and spirited, and all of us have
been benefited by them, some of us in a special manner.
The little flock is greatly strengthened and revived, and is in a better
working condition. All little jealousies and acrimonies have been
buried (I trust never to rise again), and a kindly feeling pervades the
entire atmosphere of our church circle. As a result of the revival, five
persons have been added to our church, and these five are live and
not dead Christians.
PARIS, TEXAS.

Our protracted meetings began here the fourth Sunday in June and
continued two weeks. We had no conversions, but the church was
revived. During these meetings many persons came forward to be
prayed for. Two weeks later the fire of the Holy Ghost which was
kindled here broke out at Pattonville. We joined our brethren out
there in a week and a half meeting. Before the meetings broke up
we had thirteen to come out on the Lord’s side; six joined our
church, and the rest went into other churches. Bro. Jordan Carter, a
worthy young member of my church, keeps up this work here and at
New Hope. The spiritual condition of these churches in the country is
good. Pattonville church has 30 or more members, and New Hope
and Paradise 43. These churches meet with us in a quarterly
conference regularly.
Our white brethren of the various denominations invited us colored
brethren to organize with them in a minister’s meeting which meets
every Monday at 3 p.m. We are discussing some very vital questions
in these meetings.
OPENING OF SCHOOLS.

BEREA, KY.

The Fall term of Berea College opens with greater promise than ever
before. There are more students, and they bring more money. Two-
thirds are colored, if the slightest shade of black is reckoned negro;
but, if divided according to predominance of color, fully half are
white.
McLEANSVILLE, N.C.

On the 16th of September we closed a two months Normal school,


the first ever attempted here. We enrolled 20 pupils, six of whom
had taught school, and four were preparing to teach next winter.
Most of the others were primary scholars.
Our pupils did good work. Since the school closed, some of our
pupils have attended a Teacher’s Institute in an adjoining county,
lasting a week. One of them proved to be one of the best scholars
present, was commended by the county superintendent of
instruction, who conducted the institute, and by him urged to attend
the public examination of teachers in October.
MONTGOMERY, ALA.

Swayne School opened last year with 300 pupils, this year with 400,
showing an encouraging increase of 100.
We are securing student aid from friends at the North for several
students who have gone from here to the higher institutions. Most of
our best students are quite young and can do as well here at
present, except that it is better for them to be in an institution where
they can be under proper control twenty-four hours in the day. The
social and church life of these people is so bad that we advise all to
leave for boarding-schools and colleges as soon as they can.
EMERSON INSTITUTE, MOBILE, ALA.

The institute opened its doors on the 3d inst. The full corps of seven
teachers, including music teacher, were present. In the two lower
grades the attendance of pupils somewhat exceeded that of last
year; in the higher grades it was less. The total was 52. At the end
of four days it has increased to 75. This dilatory entrance will
probably continue until the total will run up to 300, or thereabouts.
Some of our students residing at remote points wrote that many
new ones would come; but the drought has delayed, perhaps
prevented them. The uncommon heat of the summer has cut off the
expected means of some. Poverty is keeping a considerable number
of our former Normal pupils at work for the present. The outlook
presents many hopeful points.
HOWARD UNIVERSITY.

REV. W. W. PATTON, D.D., WASHINGTON, D.C.

Our new year has opened at Howard University with great promise
of good. A remarkably large attendance at prayers, the first day,
showed an increase of punctuality in the return of the old students,
and an influx of new ones. Thus far 80 new students have joined the
Normal Department and about 30 the Preparatory. The incoming
Freshman Class of College numbers 8. Already 13 new ones have
joined the Theological Department and others are expected. Many
more would have come to it, but the standard of admission is now
much higher than it used to be, and will be gradually raised as better
and better material will be furnished. We discourage and often reject
poorly qualified applicants. The Medical and Law courses are just
commencing their term, and with bright prospects. The medical
faculty is one of eminence, three of its members having been
connected with the illness of President Garfield; Dr. Purvis being the
first to prescribe for him after the shooting; Dr. Reyburn having been
one of the six physicians in regular attendance; and Dr. Lamb having
performed the operation at the autopsy. Last year this department
had 81 students (a majority being white), and this year the number
will sum up to nearly quite a hundred. It is open to ladies as well as
gentlemen. All the law graduates of last year (5 in number) have
come back to take the post-graduate course. The law students this
year will number twenty or more.
The University students, through poverty, are compelled to spend
the vacation in earning money (for which they find many
opportunities to the north of us), and have been acting as waiters at
the springs and the seaside resorts, where their good behavior
makes many friends and often secures benefactors. Eight of the
theological students gave themselves to missionary work with great
success during the summer. One received twenty converts to the
church, the Sabbath before he came back to resume study. The
others were in the rural district of Southern Virginia, dark with
ignorance, where they established day-schools as well as Sunday-
schools, aided in a very interesting Sunday-school convention of that
region, visited the families and preached the Gospel. It is thought
that several new churches will soon result from these efforts, and
one such was organized last month. They gave special attention to
encouraging young men to prepare for usefulness as teachers and
ministers, but hardly any proper facilities exist there, and poverty
prevents them from going elsewhere to obtain education. We are
continually tried by not having the means to aid those seeking the
higher education, as the number increases and their literary
character improves, while the colored people must have educated
leaders in church and state.
HAMPTON, VA.

MISS HELEN W. LUDLOW.

Hampton begins the year with a large influx of students. They have
come in much faster and more promptly than ever before. Last year,
our largest number was 385, including 70 Indians; now, on the sixth
day of school, we have 385, only 40 of whom are Indians. They
appear to be a good set—hopeful material—on the whole, in
advance of former years. Indeed, so many more have applied than it
is possible to accommodate, that it has been our duty, of course, to
select the best, and examinations have been more severe. Our
quarters are full to overflowing, especially the girls’. There is a larger
proportion of these than ever. Seven of our returning students report
that they have taught schools this vacation. A few more who will
return are still out teaching. Of the few students, sixty-one reported
having come through the agency of our graduate teachers, and
fourteen more through that of undergraduates. One girl brought
nine. Several of our graduate teachers came in person to bring their
students.
Forty-seven students reported as having worked as Sunday-school
teachers this summer. Some have been active in temperance work,
and give interesting account of their efforts, especially among the
young. They find the old people hard to touch. They are, of course,
most of them too young themselves to do as effective work as our
graduate teachers. A revival has been in progress through the
summer in some of the colored churches of Hampton, and our
students who stayed at the school to work through vacation, took
part in the meetings to some extent. Our own Sunday-school
organization was kept up under our resident graduates. In the
course of the summer our students here also interested themselves
in an effort to aid the Tuskegee Normal School, Alabama, taught by
our two graduates, Mr. Booker Washington and Miss Olivia Davidson;
and succeeded by their own exertions in raising by a festival and
otherwise, $75 towards the payment of a small farm (already half
paid for), by the purchase of which Mr. Washington is trying to put
his school on a manual labor basis.
The Hampton School Mission Association, organized last year, will
continue its work by helping in the Sunday-schools in the town, Bible
reading in the jail and poor-house, and among the aged poor, and
aiding them in other ways within their power. Our young men have
taken a great pleasure in giving a day’s work now and then to patch
up some poor old cabin against the severity of the winter, or to
supply some poor old aunty with food and fire.
As to your inquiry for the number, condition and wants of students
seeking a higher education, I suppose if the question were put to
the school, how many would like to pursue a higher education, they
would rise en masse, without always much appreciation of the labor
or the value in it; but the Hampton School is so well-known to be
established on the basis of self-help, and for the purpose of
immediate helpfulness, that it draws to it chiefly the class who are
glad of a chance to work their way through school, and are seeking
to fit themselves as promptly as possible for the work of life. The
opportunities for this, in learning trades and in Normal training, are
greater this year than ever.
General Armstrong left on September 27th for Dakota, with 30
Indian students, 23 boys and 7 girls, who having been with us three
years, are now returning to their homes. The morning they started,
the last three of them were received into the church by baptism. We
feel hopeful for all, believing in the sincerity of their purpose, as
shown in their lives, to “walk the good road by the help of Jesus.”
Every boy and young man took with him from $15 to $25 worth of
tools of his trade, which he had earned here by his own labor. The
girls had corresponding working implements. Provision has been
made ahead for their regular employment as soon as they get to
their homes, and Gen. Armstrong goes with them there, with two
ladies to take care of the girls, to get them settled, to visit their
agencies, and see their parents. He is expected back by the 15th,
and has Government authority to bring back 42 new students,
including both sexes, 25 boys and 17 girls.
Forty Indian students are still in the school, and looking forward with
interest to having some new comrades to initiate into the mysteries
of civilization they have themselves so lately acquired. They are
about half of them Arizonas, some of them Apaches, bright, docile
and earnest. We only wish that those of their tribe now on the war-
path could join them here. After what experience we have had, we
should not be afraid to try them. It has led us to the conclusion that
the Indian is a human being, and susceptible of development in the
right direction, as well as “our brother in black” or in white.
BEACH INSTITUTE.

PROF. H. H. WRIGHT, SAVANNAH, GA.

The fall term of Beach Institute has opened with a marked


improvement over the opening of a year ago. The pupils of the
previous year have returned with an earnestness for work, and their
deportment has been marked with a degree of quiet and manliness
which is very gratifying to their teachers. The new pupils who have
entered have fallen in with the current without creating the least
disturbance. The opening weeks of 1880 were marred by continual
quarreling and even fighting upon the play-ground. This year there
has been none. Quite a number of the advanced pupils were
hopefully converted during the summer, and are showing the fruits
of the Spirit in their lives in school. We have great hopes of a
continued outpouring of the Spirit upon the school.
During the recent cyclone the school-house remained comparatively
uninjured, but the “Home” was rendered roofless and floods of water
poured through the building. The colored people in this vicinity
suffered extremely. Hundreds who lived on the low islands or rice
islands, which are scarce ever covered with tidal waters, were
overwhelmed, their houses destroyed and large numbers drowned.
Even yet, a month since the storm, bodies of the dead negroes are
being found in out-of-the-way places. A planter told me today of two
such found a few days ago by his reapers in the middle of his rice
fields.
ATLANTA UNIVERSITY.

REV. C. W. FRANCIS, ATLANTA, GA.

We find on this second day of our school session a fair attendance


and good prospects for a prosperous year. The number registered
thus far is 125, of whom 82 are boarders, the number a little larger
than that of last year at the opening.
The proportion of new pupils is also a little larger, and in most cases
they come under the care and persuasion of older pupils who have
been teaching them during the vacation weeks. This mode of
recruiting has always been effective, and as our accommodations
have been used to their utmost capacity every season, we have
never ventured to employ any other means to secure attendance lest
we be overwhelmed. A most hopeful feature in the case of the
incoming students is the large preponderance of girls who come
without any special solicitation, which indicates a greatly improved
sentiment in regard to their education and position in the
community, and gives it abundant material for the most effective
work in behalf of the elevation of the people.
There has been little opportunity thus far to learn save from letters
as to the character of the missionary work done by the pupils during
their vacation, but we have good reason to know that it has been
more abundant and effective than in any season before. A larger
share of the pupils went out as followers of Christ than heretofore,
and a larger supply of temperance literature was put into their
hands, and the sentiment of the people toward them and their work
is increasingly favorable. It seems probable that the appeals for
assistance on the part of worthy pupils will be greater than usual on
account of the smaller returns their best endeavors to help
themselves have secured.
A severe and protracted drought has affected all this region, so that
the cotton crop was small and required early attention, and pupils
were taken out of school and attendance and pay were rendered
small. We meet under the shadow of sorrow, having lost five
students by death during the vacation, one of them a beloved
member of the senior class. We hope that the tender and thoughtful
feeling which manifestly prevails thus far may lead ere long to great
and blessed results.
LEWIS HIGH SCHOOL.

REV. S. E. LATHROP, MACON, GA.

Our school opened on the 3d of October with 64 scholars present.


This number was increased to nearly 90 during the first week, and
there will be constant additions until Christmas. Many of the poorest
pupils are busily picking cotton, to earn something for school
expenses, and will arrive within a month. Ten or twelve of the older
scholars of last year have now gone to Atlanta University, so that
there are not yet as many grown pupils as there will be after cotton
picking is over. Among the new students is a young Methodist
preacher, in charge of a circuit in an adjoining county. He seems
quite in earnest to learn. Another of our excellent young men was
converted while teaching during the summer, and has done good
work in Sunday-school, temperance and revival meetings. Another
taught school in the same county, and both labored earnestly in the
temperance cause. A bill was passed by the legislature this summer,
allowing the people of that county to vote on the question of
prohibiting the sale of liquor within their own limits. These two
young teachers, aided by another former pupil teaching in an
adjoining county, who has considerable talent for public speaking,
worked hard for prohibition. The result is seen in the news that
comes this morning, that prohibition carried the day by a majority of
nineteen votes.
Several new scholars have come into our school, and a larger
number will yet come through the efforts of these young teachers.
The attendance at opening is larger than for several preceding years,
and indications point toward a steady increase. Atlanta University
being within one hundred miles, draws off many of the older
students, but what is our loss is their gain. The dark and ignorant
communities of our common-wealth are being enlightened slowly
but surely, by the earnest young teachers from this and other
schools, and their influence is not small on the side of morality,
religion and progress.
The school opens more favorably than for several years before, with
an increase in the corps of teachers, and general prospects for
extended usefulness. There is a growing number of those who desire
advanced education, whose purpose it is to fit themselves to enter
some of the higher institutions. Their greatest hindrance is their
poverty; but the pay for school teaching is improving somewhat,
although most have to wait six or eight months before receiving
what they earn. There is, however, general progress in most
localities, and we are glad to believe that the Lewis High School is
doing its share, reaching out to uplift this whole region of country.
BURRELL SCHOOL.

MR. E. C. SILSBY, SELMA, ALA.

We had feared that the effect of a prolonged season of drought,


occasioning small crops and high prices, would be to lessen the
attendance considerably. In this, however, an agreeable
disappointment was in store, as the number present upon the
opening day was four larger than the preceding year, and nearly
twice that for 1879. We opened with an attendance of 153, 19 of
which number are members of the advanced grammar and high
school departments. A number of last year’s advanced pupils have
indicated their intention to re-enter shortly. As yet, last year’s
scholars who have been employed in teaching have not returned.
From a number of these we have received word with reference to
their work, and learned of their expectations to be with us again.
One young man wrote of establishing a temperance society, and
laboring in a revival in the local church. He had a good Sunday-
school which he had supplied with “Quarterlies” containing notes on
the lessons, and he seemed to be accomplishing much good. His
location is one where for many years he has taught school. He
writes that he expects to return to Burrell.
Another young man, who says that he will re-enter, was last year in
school here for the first time, and was brought through the agency
of the former. He has written intelligently of his Sunday-school, and
has also sent on funds to me to be expended in papers.
Twin brothers from a town in an adjoining county, and last year’s
pupils, were converted at a special revival season in the
Congregational church here during the winter. To one of the
teachers, one brother wrote that he was “doing the best he could
teaching in the Sunday-school.” The other said that “the people out
there did not know much about managing a Sunday-school properly,
but he was working in it, and lent his “Quarterly” around among
others, showing them how to study their lessons from it.” These
brothers are about 15 years old.
We learn of the expected return of a pupil of ’79 who has been
laboring very acceptably for some time in Louisiana in Sunday-
school, church and temperance work. He brings a recruit for Burrell
also. Another last year’s pupil of ours, from the High school grade,
leaves the scholar’s seat to occupy a position behind the teacher’s
desk, in the building where for years she has been a studious
learner. She is a teacher in the A. M. E. Sunday-school of this place,
and a member of the choir. Two other young ladies, former
classmates of hers in Burrell, are, for the second year, teaching with
us also.
The nature of our school being, as it is, a city school, we have not
tried to crowd our work upon the attention of non-residents. We
have had, however, pupils from the country and adjoining counties,
every year for some time, with rare exceptions. New pupils from
elsewhere, brought through the agency of others, have been
referred to above. A very promising young man entered this year
from a county adjoining this one on the east, who had heard of the
school from former pupils. Three persons from a northern county
are, I am informed, to come in company with a last year’s pupil. The
condition of the cotton crop is such, that some are probably
remaining away to assist in gathering and storing the same. This is
often the case with country scholars.
The second day of the present session, one came to us as a pupil
who has sat in the legislative hall of this State as one of our county’s
representatives. He has been a teacher since then, and realizing his
deficiency, comes to learn along with children. We think he shows a
commendable spirit, and judging from his persistency, predict his
success.
TOUGALOO, MISS.

MISS K. K. KOONS.

The year opens full of promise to us. The school is not only much
larger than at the same time last year, but larger than at the same
time in any previous year except the first few, before the zeal of this
people on the subject of education had had time to abate. Though
Strieby Hall is not yet finished, the lower floor, chapel and recitation
rooms lack but the finishing touches and furniture, the first of which
it is rapidly receiving, the last of which we look for daily.
We held our opening exercises in the chapel, fitted up with
temporary seats. Our overcrowded Girl’s Hall and dining-room of last
year prepared us thoroughly to enjoy the room which the
enlargement to the building affords. Though neither building is
completed, the work is being rapidly pushed forward. A number of
our students, who came expecting to enter school at once, were
glad of the opportunity to help themselves, and are putting in a
month of work upon the buildings before entering, thus somewhat
lessening the number enrolled at the opening.
Reports of the summer’s work given by our student teachers at our
weekly prayer meeting were very encouraging indeed. It has been
an unusually hard summer for many of them. Delay in finding vacant
schools, the failure of people to keep engagements made with
teachers, and hard fare, were very common. But though these
things came to us in our letters from them during the summer, they
were scarcely referred to in their reports. Interest in their work and
the people with whom they labored entirely overshadowed the
hardships. The disposition to take a cheerful view of things, and
cheerfully and earnestly to meet and work against difficulties and
discouragements, is becoming more manifest. Perhaps this is one of
the good results to be wrought in them by the sacrifice and self-
denial so bravely made after the burning of our chapel last spring.
The interest in the Sabbath-school work is greater. Fewer signers to
the pledge are reported than in previous years. The temperance
work is the “pons asinorum” of our young people. And well may it
be, in view of the almost universal habit of drinking and using snuff
and tobacco. In this work they do grow greatly “disencouraged.” But
the number of signers to the pledge is, after all, no criterion by
which to measure the quiet work done in the line of temperance.
The number enrolled at the opening last year was 46, this year 74.
The number of day scholars taught by our twenty student teachers
was 1,539; Sabbath-school scholars, 795; signers to pledge, 160;
conversions, 32.
FISK UNIVERSITY, NASHVILLE, TENN.

BY REV. H. S. BENNETT.

Fisk University has opened this year with unusual prosperity. There
are at this early date in the year 285 pupils in the entire school.
There are in Jubilee Hall 121 boarders, which is within 30 as many
as have ever boarded in the hall. Judging from applications which
have been made, there will be by the middle of January next 75
more. Last night, at the faculty meeting, the question was earnestly
discussed, “What shall we do with those who apply, when the hall is
full?” as it is likely to be within a very few weeks. It is felt by all of
the faculty that if the crops had not been cut short by the drought
we should have had a rush of students altogether unprecedented in
the history of the University.
It is felt by those who have known the students for a number of
years that those of this year are a superior class. The quality of the
students improves with every year, showing that others are at work
elsewhere. We have received already this year several students of
advanced grade, who have come prepared to enter the college
classes. At this time we are negotiating with one who desires to
enter the senior college class and graduate next commencement.
We expect him in a few days.
The past years of schooling are beginning to tell upon the higher
training of the colored youth, and those who come to Fisk for the
first time take much higher grades than new students were wont to
do a few years ago. Most of the old students have been engaged in
teaching during the summer vacation. It is estimated that of 85 in
the collegiate department, 60 or 65 taught school during the
summer. Wherever these teachers go, they secure a good name for
industry, conscientiousness, ability and energy. We are constantly
getting good words from white people, directors, superintendents
and private citizens in regard to the faithfulness and acceptance with
which our students discharge their duties. Almost all those who
teach are Christians and engage in Christian work, as a matter of
course, when they begin their day schools. As a general thing, they
enter at once into the Sabbath-school if there is one, and start one if
there is not, and generally get the entire neighborhood enlisted.
There are two interesting features in relation to the students, the
like of which we have never had before. During the past few years
the trustees of the Peabody fund have sustained a Normal school for
white pupils. The effort has been made to secure an appropriation
from the State for this school in the years that are past. At the last
session of the Legislature an appropriation of $10,000 was made for
Normal schools, $2,500 for the colored children of the State, that
being their relative share. The Board of Education for the State, to
whom the disbursement of this fund was left, decided that the fund
for the colored students should be divided among 50 pupils, and that
they should have the privilege of choosing between five schools to
which they should go. Each pupil would thus be entitled to $50, and
each school would receive on an average 10 students. Up to the
present time Fisk has received 18 out of the 50, and it is well known
that many of the Senators who had the power of appointment had
not taken action. We have no doubt that others will come as the
year passes by.
The other feature is this. Several colored men were elected to the
last Legislature, and as members had the right to appoint cadets to
the East Tennessee University, of course they all appointed colored
cadets. Some other republican members also appointed colored
cadets. This threw the trustees of the East Tennessee University into
great perplexity. It is against the law of the State to educate white
and colored pupils in the same institution: it is also very much
against the traditional prejudices not only of the trustees of the
University, but also of the people of the State. The trustees met, and
after a thorough discussion determined to make arrangements with
Fisk University if possible, to take their colored cadets at $30 apiece.
Fisk University was not averse to the arrangement, and so the
question was settled. We have now in the University seven cadets,
students of the East Tennessee University.
It is accepted by all here as an important truth, that the longer we
can keep a student the better it will be for him and the institution
and the work. The students in the collegiate department give tone to
the whole institution. Every department is lifted to a higher standard
by the high standard of the college department. As the college
graduates go out into the world, they have, without an exception,
taken advanced positions as teachers or other professional men.
Livingstone Hall is now having its roof put on, and all are watching
its progress with the greatest interest, as promising a time when the
facilities of the institution will be almost doubled. What we shall next
need will be an ample endowment. Who will provide this for us?
OBITUARY.
DEATH OF MRS. T. C. STEWARD.

On the 3d of July last Mrs. T. C. Palmer Steward passed away to her


rest, leaving behind a devoted husband and three young children.
She was born in Windham, Portage Co., Ohio, August 10th, 1839.
She commenced teaching school when fourteen years of age and
was graduated from Lake Erie Female Seminary, Painesville, Ohio,
July, 1862, having secured her education largely through her own
efforts. In October, 1866, she was commissioned by the A. M. A. as
a teacher among the Freedmen, and for ten years continued to labor
in the South under its direction, being at Chattanooga two years, at
Marion four years and at Fisk University four years. In 1868 she was
married to Hon. T. C. Steward, who was stationed at Marion, Ala., in
charge of the work of the Association. Mr. Steward took an active
part in the work of reconstruction in Alabama, and in the most trying
and dangerous period in the political history of the State, after the
war, represented his district in the legislature. In those times of
imminent peril Mrs. Steward stood unflinchingly by her husband’s
side and manifested the highest qualities of true Christian heroism.
In 1876 Mr. and Mrs. Steward retired from the service of the A. M. A.
and moved to Chattanooga, Tenn., where Mrs. Steward’s death
occurred in their new and pleasant home on the crest of Missionary
Ridge.
Mrs. Steward was a remarkably efficient and successful teacher, and
a most devoted and earnest Christian worker.

You might also like