SlideShare a Scribd company logo
Starting Out with Java From control structures
through Objects 7th Edition Tony Gaddis install
download
https://ebookmeta.com/product/starting-out-with-java-from-
control-structures-through-objects-7th-edition-tony-gaddis/
Download more ebook from https://ebookmeta.com
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!
Starting Out with C++ - From Control Structures through
Objects 9th Edition Tony Gaddis
https://ebookmeta.com/product/starting-out-with-c-from-control-
structures-through-objects-9th-edition-tony-gaddis/
Starting Out with Visual Basic - 8th Edition Tony
Gaddis
https://ebookmeta.com/product/starting-out-with-visual-basic-8th-
edition-tony-gaddis/
Starting out with Visual C# 5th Edition Tony Gaddis
https://ebookmeta.com/product/starting-out-with-visual-c-5th-
edition-tony-gaddis/
Print Culture and the Formation of the Anarchist
Movement in Spain 1890 1915 1st Edition James Michael
Yeoman
https://ebookmeta.com/product/print-culture-and-the-formation-of-
the-anarchist-movement-in-spain-1890-1915-1st-edition-james-
michael-yeoman/
Identity Configuration of the Russian Youth monograph
1st Edition Zinurova
https://ebookmeta.com/product/identity-configuration-of-the-
russian-youth-monograph-1st-edition-zinurova/
Best Hikes Los Angeles The Greatest Trails in the La
Mountains Beaches and Canyons 2nd Edition Allen Riedel
Monique Riedel
https://ebookmeta.com/product/best-hikes-los-angeles-the-
greatest-trails-in-the-la-mountains-beaches-and-canyons-2nd-
edition-allen-riedel-monique-riedel/
Encounters with the Real in Contemporary Italian
Literature and Cinema 1st Edition Loredana Di Martino
https://ebookmeta.com/product/encounters-with-the-real-in-
contemporary-italian-literature-and-cinema-1st-edition-loredana-
di-martino/
Next Door Blake Pierce
https://ebookmeta.com/product/next-door-blake-pierce/
A Best Practice Guide to Sex and Storytelling Filming
Scenes with Sex and Nudity 1st Edition John Bucher
https://ebookmeta.com/product/a-best-practice-guide-to-sex-and-
storytelling-filming-scenes-with-sex-and-nudity-1st-edition-john-
bucher/
An Artist s Guide to Programming Jim Parker
https://ebookmeta.com/product/an-artist-s-guide-to-programming-
jim-parker/
Starting Out with Java From control structures through Objects 7th Edition Tony Gaddis
Starting Out with Java From control structures through Objects 7th Edition Tony Gaddis
Starting Out With Java ™
From Control Structures through Objects
Starting Out With Java ™
From Control Structures through Objects
SEVENTH EDITION
Tony Gaddis
Haywood Community College
330 Hudson Street, NY NY 10013
Senior Vice President Courseware Portfolio Management: Marcia J.
Horton
Director, Portfolio Management: Engineering, Computer Science &
Global Editions: Julian Partridge
Portfolio Manager: Matt Goldstein
Portfolio Management Assistant: Meghan Jacoby
Managing Content Producer: Scott Disanno
Content Producer: Amanda Brands
Rights and Permissions Manager: Ben Ferrini
Manufacturing Buyer, Higher Ed, Lake Side Communications, Inc.
(LSC): Maura Zaldivar-Garcia
Inventory Manager: Ann Lam
Product Marketing Manager: Yvonne Vannatta
Field Marketing Manager: Demetrius Hall
Marketing Assistant: Jon Bryant
Cover Designer: Joyce Wells
Cover Photo: Shutterstock/Tim UR
Printer/Binder: LSC Communications, Inc.
Full-Service Project Management: Sasibalan Chidambaram, SPi Global
Credits and acknowledgments borrowed from other sources and
reproduced, with permission, in this textbook appear on appropriate page
within text.
Copyright © 2019, 2016, 2013 by Pearson Education, Inc., Hoboken, New
Jersey 07030. All rights reserved. Manufactured in the United States of
America. This publication is protected by copyright and permissions
should be obtained from the publisher prior to any prohibited
reproduction, storage in a retrieval system, or transmission in any form or
by any means, electronic, mechanical, photocopying, recording, or
likewise. For information regarding permissions, request forms and the
appropriate contacts within the Pearson Education Global Rights &
Permissions department, please visit http://www.pearsoned.com/
permissions/.
Many of the designations by manufacturers and seller to distinguish their
products are claimed as trademarks. Where those designations appear in
this book, and the publisher was aware of a trademark claim, the
designations have been printed in initial caps or all caps.
Unless otherwise indicated herein, any third-party trademarks that may
appear in this work are the property of their respective owners and any
references to third-party trademarks, logos or other trade dress are for
demonstrative or descriptive purposes only. Such references are not
intended to imply any sponsorship, endorsement, authorization, or
promotion of Pearson’s products by the owners of such marks, or any
relationship between the owner and Pearson Education, Inc. or its
affiliates, authors, licensees or distributors.
Microsoft and/or its respective suppliers make no representations about
the suitability of the information contained in the documents and related
graphics published as part of the services for any purpose. All such
documents and related graphics are provided “as is” without warranty of
any kind. Microsoft and/or its respective suppliers hereby disclaim all
warranties and conditions with regard to this information, including all
warranties and conditions of merchantability. Whether express, implied
or statutory, fitness for a particular purpose, title and non infringement. In
no event shall microsoft and/or its respective suppliers be liable for any
special, indirect or consequential damages or any damages whatsoever
resulting from loss of use, data or profits, whether in an action of
contract. Negligence or other tortious action, arising out of or in
connection with the use or performance of information available from the
services.
The documents and related graphics contained herein could include
technical inaccuracies or typographical errors changes are periodically
added to the information herein. Microsoft and/or its respective suppliers
may make improvements and/or changes in the product(s) and/or the
program(s) described herein at any time partial screen shots may be
viewed in full within the software version specified.
Microsoft Windows , and Microsoft Office are registered trademarks of
the Microsoft Corporation in the U.S.A. and other countries. This book is
not sponsored or endorsed by or affiliated with the Microsoft
Corporation.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Other names may be trademarks of their respective owners.
Library of Congress Cataloging-in-Publication Data
Names: Gaddis, Tony, author.
Title: Starting out with Java. From control structures through objects /
Tony Gaddis, Haywood Community College.
Description: Seventh edition. | NY, NY : Pearson Education, Inc., [2019] |
Includes index.
Identifiers: LCCN 2017060354| ISBN 9780134802213 | ISBN 0134802217
Subjects: LCSH: Java (Computer program language) | Data structures
(Computer science) | Object-oriented programming (Computer science)
® ® ®
Classification: LCC QA76.73.J38 G333 2019 | DDC 005.13/3--dc23 LC
record
available at https://lccn.loc.gov/2017060354
1 18
ISBN 10: 0-13-480221-7
ISBN 13: 978-0-13-480221-3
Contents in Brief
Chapter 1 Introduction to Computers and Java 1
Chapter 2 Java Fundamentals 27
Chapter 3 Decision Structures 111
Chapter 4 Loops and Files 189
Chapter 5 Methods 269
Chapter 6 A First Look at Classes 317
Chapter 7 Arrays and the ArrayList Class 403
Chapter 8 A Second Look at Classes and Objects 493
Chapter 9 Text Processing and More about Wrapper Classes 557
Chapter 10 Inheritance 611
Chapter 11 Exceptions and Advanced File I/O 701
Chapter 12 JavaFX: GUI Programming and Basic Controls 759
Chapter 13 JavaFX: Advanced Controls 823
Chapter 14 JavaFX: Graphics, Effects, and Media 909
Chapter 15 Recursion 999
Chapter 16 Databases 1027
Index 1109
Appendices A–M Companion Website
Case Studies 1–7 Companion Website

















Chapters 17–20 Companion Website
Contents
Preface xxiii
Chapter 1 Introduction to Computers and Java 1
1.1 Introduction 1
1.2 Why Program? 1
1.3 Computer Systems: Hardware and Software 2
Hardware 2
Software 5
1.4 Programming Languages 6
What Is a Program? 6
A History of Java 8
1.5 What Is a Program Made Of? 8
Language Elements 8
Lines and Statements 11
Variables 11
The Compiler and the Java Virtual Machine 12
Java Software Editions 13
Compiling and Running a Java Program 14
1.6 The Programming Process 16
Software Engineering 18
1.7 Object-Oriented Programming 19
Review Questions and Exercises 21





















Programming Challenge 25
Chapter 2 Java Fundamentals 27
2.1 The Parts of a Java Program 27
2.2 The print and println Methods, and the Java API 33
2.3 Variables and Literals 39
Displaying Multiple Items with the Operator 40
Be Careful with Quotation Marks 41
More about Literals 42
Identifiers 42
Class Names 44
2.4 Primitive Data Types 44
The Integer Data Types 46
Floating-Point Data Types 47
The boolean Data Type 50
The char Data Type 50
Variable Assignment and Initialization 52
Variables Hold Only One Value at a Time 53
2.5 Arithmetic Operators 54
Integer Division 57
Operator Precedence 57
Grouping with Parentheses 59
The Math Class 62
2.6 Combined Assignment Operators 63





+ 

















2.7 Conversion between Primitive Data Types 65
Mixed Integer Operations 67
Other Mixed Mathematical Expressions 68
2.8 Creating Named Constants with final 69
2.9 The String Class 70
Objects Are Created from Classes 71
The String Class 71
Primitive Type Variables and Class Type Variables 71
Creating a String Object 72
2.10 Scope 76
2.11 Comments 78
2.12 Programming Style 83
2.13 Reading Keyboard Input 85
Reading a Character 89
Mixing Calls to nextLine with Calls to Other Scanner Methods 89
2.14 Dialog Boxes 93
Displaying Message Dialogs 93
Displaying Input Dialogs 94
An Example Program 94
Converting String Input to Numbers 96
2.15 Common Errors to Avoid 99
Review Questions and Exercises 100
Programming Challenges 106























Chapter 3 Decision Structures 111
3.1 The if Statement 111
Using Relational Operators to Form Conditions 113
Putting It All Together 114
Programming Style and the if Statement 117
Be Careful with Semicolons 117
Having Multiple Conditionally Executed Statements 118
Flags 118
Comparing Characters 119
3.2 The if-else Statement 120
3.3 Nested if Statements 122
3.4 The if-else-if Statement 128
3.5 Logical Operators 134
The Precedence of Logical Operators 139
Checking Numeric Ranges with Logical Operators 140
3.6 Comparing String Objects 142
Ignoring Case in String Comparisons 146
3.7 More about Variable Declaration and Scope 147
3.8 The Conditional Operator (Optional) 149
3.9 The switch Statement 150
3.10 Displaying Formatted Output with System.out.printf and
String.format 160
Format Specifier Syntax 163






















Precision 164
Specifying a Minimum Field Width 164
Flags 167
Formatting String Arguments 170
The String.format Method 172
3.11 Common Errors to Avoid 174
Review Questions and Exercises 175
Programming Challenges 181
Chapter 4 Loops and Files 189
4.1 The Increment and Decrement Operators 189
The Difference between Postfix and Prefix Modes 192
4.2 The while Loop 193
The while Loop Is a Pretest Loop 196
Infinite Loops 196
Don’t Forget the Braces with a Block of Statements 197
Programming Style and the while Loop 198
4.3 Using the while Loop for Input Validation 200
4.4 The do-while Loop 204
4.5 The for Loop 207
The for Loop Is a Pretest Loop 210
Avoid Modifying the Control Variable in the Body of the for Loop 211
Other Forms of the Update Expression 211
Declaring a Variable in the for Loop’s Initialization Expression 211























Creating a User Controlled for Loop 212
Using Multiple Statements in the Initialization and Update Expressions 213
4.6 Running Totals and Sentinel Values 216
Using a Sentinel Value 219
4.7 Nested Loops 221
4.8 The break and continue Statements (Optional) 229
4.9 Deciding Which Loop to Use 229
4.10 Introduction to File Input and Output 230
Using the PrintWriter Class to Write Data to a File 230
Appending Data to a File 236
Specifying the File Location 237
Reading Data from a File 237
Reading Lines from a File with the nextLine Method 238
Adding a throws Clause to the Method Header 241
Checking for a File’s Existence 245
4.11 Generating Random Numbers with the Random Class 249
4.12 Common Errors to Avoid 255
Review Questions and Exercises 256
Programming Challenges 262
Chapter 5 Methods 269
5.1 Introduction to Methods 269
void Methods and Value-Returning Methods 270
Defining a void Method 271























Calling a Method 272
Layered Method Calls 276
Using Documentation Comments with Methods 277
5.2 Passing Arguments to a Method 279
Argument and Parameter Data Type Compatibility 281
Parameter Variable Scope 282
Passing Multiple Arguments 282
Arguments Are Passed by Value 284
Passing Object References to a Method 285
Using the @param Tag in Documentation Comments 288
5.3 More about Local Variables 290
Local Variable Lifetime 292
Initializing Local Variables with Parameter Values 292
5.4 Returning a Value from a Method 293
Defining a Value-Returning Method 293
Calling a Value-Returning Method 294
Using the @return Tag in Documentation Comments 296
Returning a boolean Value 300
Returning a Reference to an Object 300
5.5 Problem Solving with Methods 302
Calling Methods That Throw Exceptions 305
5.6 Common Errors to Avoid 305
Review Questions and Exercises 306























Programming Challenges 311
Chapter 6 A First Look at Classes 317
6.1 Objects and Classes 317
Classes: Where Objects Come From 318
Classes in the Java API 319
Primitive Variables vs. Objects 321
6.2 Writing a Simple Class, Step by Step 324
Accessor and Mutator Methods 338
The Importance of Data Hiding 338
Avoiding Stale Data 339
Showing Access Specification in UML Diagrams 339
Data Type and Parameter Notation in UML Diagrams 339
Layout of Class Members 340
6.3 Instance Fields and Methods 341
6.4 Constructors 346
Showing Constructors in a UML Diagram 348
Uninitialized Local Reference Variables 348
The Default Constructor 348
Writing Your Own No-Arg Constructor 349
The String Class Constructor 350
6.5 Passing Objects as Arguments 358
6.6 Overloading Methods and Constructors 370
The BankAccount Class 372























Overloaded Methods Make Classes More Useful 378
6.7 Scope of Instance Fields 378
Shadowing 379
6.8 Packages and import Statements 380
Explicit and Wildcard import Statements 380
The java.lang Package 381
Other API Packages 381
6.9 Focus on Object-Oriented Design: Finding the Classes and Their
Responsibilities 382
Finding the Classes 382
Identifying a Class’s Responsibilities 385
This Is Only the Beginning 388
6.10 Common Errors to Avoid 388
Review Questions and Exercises 389
Programming Challenges 394
Chapter 7 Arrays and the ArrayList Class 403
7.1 Introduction to Arrays 403
Accessing Array Elements 405
Inputting and Outputting Array Contents 406
Java Performs Bounds Checking 409
Watch Out for Off-by-One Errors 410
Array Initialization 411
Alternate Array Declaration Notation 412






















7.2 Processing Array Elements 413
Array Length 415
The Enhanced for Loop 416
Letting the User Specify an Array’s Size 417
Reassigning Array Reference Variables 419
Copying Arrays 420
7.3 Passing Arrays as Arguments to Methods 422
7.4 Some Useful Array Algorithms and Operations 426
Comparing Arrays 426
Summing the Values in a Numeric Array 427
Getting the Average of the Values in a Numeric Array 428
Finding the Highest and Lowest Values in a Numeric Array 428
The SalesData Class 429
Partially Filled Arrays 437
Working with Arrays and Files 438
7.5 Returning Arrays from Methods 439
7.6 String Arrays 441
Calling String Methods from an Array Element 443
7.7 Arrays of Objects 444
7.8 The Sequential Search Algorithm 447
7.9 Two-Dimensional Arrays 450
Initializing a Two-Dimensional Array 454
The length Field in a Two-Dimensional Array 455























Displaying All the Elements of a Two-Dimensional Array 457
Summing All the Elements of a Two-Dimensional Array 457
Summing the Rows of a Two-Dimensional Array 458
Summing the Columns of a Two-Dimensional Array 458
Passing Two-Dimensional Arrays to Methods 459
Ragged Arrays 461
7.10 Arrays with Three or More Dimensions 462
7.11 The Selection Sort and the Binary Search Algorithms 463
The Selection Sort Algorithm 463
The Binary Search Algorithm 466
7.12 Command-Line Arguments and Variable-Length Argument Lists 468
Command-Line Arguments 469
Variable-Length Argument Lists 470
7.13 The ArrayList Class 472
Creating and Using an ArrayList Object 473
Using the Enhanced for Loop with an ArrayList 474
The ArrayList Class’s toString method 475
Removing an Item from an ArrayList 476
Inserting an Item 477
Replacing an Item 478
Capacity 479
Storing Your Own Objects in an ArrayList 479






















Using the Diamond Operator for Type Inference 480
7.14 Common Errors to Avoid 481
Review Questions and Exercises 481
Programming Challenges 486
Chapter 8 A Second Look at Classes and Objects 493
8.1 Static Class Members 493
A Quick Review of Instance Fields and Instance Methods 493
Static Members 494
Static Fields 494
Static Methods 497
8.2 Passing Objects as Arguments to Methods 500
8.3 Returning Objects from Methods 503
8.4 The toString Method 505
8.5 Writing an equals Method 509
8.6 Methods That Copy Objects 512
Copy Constructors 514
8.7 Aggregation 515
Aggregation in UML Diagrams 523
Security Issues with Aggregate Classes 523
Avoid Using null References 525
8.8 The this Reference Variable 528
Using this to Overcome Shadowing 529






















Using this to Call an Overloaded Constructor from Another Constructor
530
8.9 Enumerated Types 531
Enumerated Types Are Specialized Classes 532
Switching On an Enumerated Type 538
8.10 Garbage Collection 540
The finalize Method 542
8.11 Focus on Object-Oriented Design: Class Collaboration 542
Determining Class Collaborations with CRC Cards 545
8.12 Common Errors to Avoid 546
Review Questions and Exercises 547
Programming Challenges 551
Chapter 9 Text Processing and More about Wrapper Classes 557
9.1 Introduction to Wrapper Classes 557
9.2 Character Testing and Conversion with the Character Class 558
Character Case Conversion 563
9.3 More String Methods 566
Searching for Substrings 566
Extracting Substrings 572
Methods That Return a Modified String 576
The Static valueOf Methods 577
9.4 The StringBuilder Class 579
The StringBuilder Constructors 580
Other StringBuilder Methods 581























The toString Method 584
9.5 Tokenizing Strings 589
9.6 Wrapper Classes for the Numeric Data Types 594
The Static toString Methods 594
The toBinaryString , toHexString , and toOctalString Methods
594
The MIN_VALUE and MAX_VALUE Constants 595
Autoboxing and Unboxing 595
9.7 Focus on Problem Solving: The TestScoreReader Class 597
9.8 Common Errors to Avoid 601
Review Questions and Exercises 601
Programming Challenges 605
Chapter 10 Inheritance 611
10.1 What Is Inheritance? 611
Generalization and Specialization 611
Inheritance and the “Is a” Relationship 612
Inheritance in UML Diagrams 620
The Superclass’s Constructor 621
Inheritance Does Not Work in Reverse 623
10.2 Calling the Superclass Constructor 624
When the Superclass Has No Default or No-Arg Constructors 630
Summary of Constructor Issues in Inheritance 631
10.3 Overriding Superclass Methods 632






















Overloading versus Overriding 637
Preventing a Method from Being Overridden 640
10.4 Protected Members 641
Package Access 646
10.5 Chains of Inheritance 647
Class Hierarchies 653
10.6 The Object Class 653
10.7 Polymorphism 655
Polymorphism and Dynamic Binding 656
The “Is-a” Relationship Does Not Work in Reverse 658
The instanceof Operator 659
10.8 Abstract Classes and Abstract Methods 660
Abstract Classes in UML 666
10.9 Interfaces 667
An Interface is a Contract 669
Fields in Interfaces 673
Implementing Multiple Interfaces 673
Interfaces in UML 673
Default Methods 674
Polymorphism and Interfaces 676
10.10 Anonymous Inner Classes 681
10.11 Functional Interfaces and Lambda Expressions 684
10.12 Common Errors to Avoid 689























Review Questions and Exercises 690
Programming Challenges 696
Chapter 11 Exceptions and Advanced File I/O 701
11.1 Handling Exceptions 701
Exception Classes 702
Handling an Exception 703
Retrieving the Default Error Message 707
Polymorphic References to Exceptions 710
Using Multiple catch Clauses to Handle Multiple Exceptions 710
The finally Clause 718
The Stack Trace 720
Handling Multiple Exceptions with One catch Clause 721
When an Exception Is Not Caught 723
Checked and Unchecked Exceptions 724
11.2 Throwing Exceptions 725
Creating Your Own Exception Classes 728
Using the @exception Tag in Documentation Comments 731
11.3 Advanced Topics: Binary Files, Random Access Files, and Object Serialization
732
Binary Files 732
Random Access Files 739
Object Serialization 744
Serializing Aggregate Objects 748






















11.4 Common Errors to Avoid 749
Review Questions and Exercises 749
Programming Challenges 755
Chapter 12 JavaFX: GUI Programming and Basic Controls 759
12.1 Graphical User Interfaces 759
Event-Driven GUI Programs 761
12.2 Introduction to JavaFX 762
Controls 762
Stages and Scenes 763
The Application Class 763
12.3 Creating Scenes 765
Creating Controls 766
Creating Layout Containers 766
Creating a Scene Object 767
Adding the Scene Object to the Stage 768
Setting the Size of the Scene 770
Aligning Controls in an HBox Layout Container 770
12.4 Displaying Images 772
Loading Images from an Internet Location 775
Setting the Size of an Image 775
Preserving the Image’s Aspect Ratio 775
Changing an ImageView’s Image 776
12.5 More about the HBox, VBox , and GridPane Layout Containers 776























The HBox Layout Container 777
The VBox Layout Container 782
The GridPane Layout Container 784
Using Multiple Layout Containers in the Same Screen 791
12.6 Button Controls and Events 792
Handling Events 794
Writing Event Handlers 794
Registering an Event Handler 795
12.7 Reading Input with TextField Controls 799
12.8 Using Anonymous Inner Classes and Lambda Expressions to Handle Events
803
Using Anonymous Inner Classes to Create Event Handlers 803
Using Lambda Expressions to Create Event Handlers 806
12.9 The BorderPane Layout Container 808
12.10 The ObservableList Interface 812
12.11 Common Errors to Avoid 814
Review Questions and Exercises 814
Programming Challenges 818
Chapter 13 JavaFX: Advanced Controls 823
13.1 Styling JavaFX Applications with CSS 823
Type Selector Names 824
Style Properties 825
Applying a Stylesheet to a JavaFX Application 826






















Applying Styles to the Root Node 830
Specifying Multiple Selectors in the Same Style Definition 832
Working with Colors 832
Creating a Custom Style Class Name 834
ID Selectors 836
Inline Style Rules 837
13.2 RadioButton Controls 838
Determining in Code Whether a RadioButton Is Selected 839
Selecting a RadioButton in Code 839
Responding to RadioButton Clicks 844
13.3 CheckBox Controls 848
Determining in Code Whether a CheckBox Is Selected 848
Selecting a CheckBox in Code 849
Responding to CheckBox Clicks 853
13.4 ListView Controls 853
Retrieving the Selected Item 855
Retrieving the Index of the Selected Item 856
Responding to Item Selection with an Event Handler 859
Adding Items versus Setting Items 860
Initializing a ListView with an Array or an ArrayList 861
Selection Modes 862
Retrieving Multiple Selected Items 863






















Working With the Elements of an ObservableList 866
Converting an ObservableList to an Array 867
Using Code to Select an Item in a ListView 868
ListView Orientation 868
Creating ListViews of Objects Other Than String 869
13.5 ComboBox Controls 874
Retrieving the Selected Item 875
Responding to ComboBox Item Selection with an Event Handler 877
Editable ComboBoxes 879
13.6 Slider Controls 880
13.7 TextArea Controls 885
13.8 Menus 887
Assigning Mnemonics to Menu Items 895
13.9 The FileChooser Class 897
Displaying a FileChooser Dialog Box 898
13.10 Using Console Output to Debug a GUI Application 898
13.11 Common Errors to Avoid 902
Review Questions 902
Programming Challenges 906
Chapter 14 JavaFX: Graphics, Effects, and Media 909
14.1 Drawing Shapes 909
The Screen Coordinate System 909
The Shape Class and Its Subclasses 910























The Line Class 911
Changing the Stroke Color 914
The Circle Class 914
The Rectangle Class 918
The Ellipse Class 921
The Arc Class 924
The Polygon Class 928
The Polyline Class 931
The Text Class 933
Rotating Nodes 936
Scaling Nodes 938
14.2 Animation 940
The TranslateTransition Class 941
The RotateTransition Class 944
The ScaleTransition Class 949
The StrokeTransition Class 952
The FillTransition Class 953
The FadeTransition Class 954
Controlling the Animation 956
Specifying an Interpolator 956
14.3 Effects 958
The DropShadow Class 958






















The InnerShadow Class 961
The ColorAdjust Class 962
The BoxBlur , GaussianBlur , and MotionBlur Classes 962
The SepiaTone Class 965
The Glow Class 966
The Reflection Class 967
Combining Effects 967
14.4 Playing Sound Files 969
Registering an EndOfMedia Event Handler 971
14.5 Playing Videos 974
14.6 Handling Key Events 979
Using an Anonymous Inner Class to Register a Key Event Handler to the Scene
980
Using a Lambda Expression to Register a Key Event Handler to the Scene 981
14.7 Handling Mouse Events 986
14.8 Common Errors to Avoid 992
Review Questions 992
Programming Challenges 995
Chapter 15 Recursion 999
15.1 Introduction to Recursion 999
15.2 Solving Problems with Recursion 1002
Direct and Indirect Recursion 1006
15.3 Examples of Recursive Methods 1007






















Summing a Range of Array Elements with Recursion 1007
Drawing Concentric Circles 1008
The Fibonacci Series 1011
Finding the Greatest Common Divisor 1012
15.4 A Recursive Binary Search Method 1014
15.5 The Towers of Hanoi 1017
15.6 Common Errors to Avoid 1021
Review Questions and Exercises 1022
Programming Challenges 1025
Chapter 16 Databases 1027
16.1 Introduction to Database Management Systems 1027
JDBC 1028
SQL 1029
Using a DBMS 1029
Java DB and Apache Derby 1030
Creating the CoffeeDB Database 1030
Connecting to the CoffeeDB Database 1030
Connecting to a Password-Protected Database 1032
16.2 Tables, Rows, and Columns 1033
Column Data Types 1035
Primary Keys 1035
16.3 Introduction to the SQL SELECT Statement 1036
Passing an SQL Statement to the DBMS 1038























Specifying Search Criteria with the WHERE Clause 1048
Sorting the Results of a SELECT Query 1054
Mathematical Functions 1055
16.4 Inserting Rows 1058
Inserting Rows with JDBC 1060
16.5 Updating and Deleting Existing Rows 1062
Updating Rows with JDBC 1063
Deleting Rows with the DELETE Statement 1067
Deleting Rows with JDBC 1067
16.6 Creating and Deleting Tables 1071
Removing a Table with the DROP TABLE Statement 1074
16.7 Creating a New Database with JDBC 1074
16.8 Scrollable Result Sets 1076
16.9 Result Set Metadata 1077
16.10 Relational Data 1084
Joining Data from Multiple Tables 1086
An Order Entry System 1087
16.11 Advanced Topics 1100
Transactions 1100
Stored Procedures 1101
16.12 Common Errors to Avoid 1102
Review Questions and Exercises 1102
Programming Challenges 1107























Index 1109
The following appendices, online chapters, and online case studies are available on the
book’s online resource page at www.pearson.com/cs-resources.
Online Appendices:
Appendix A: The ASCII/Unicode Characters
Appendix B: Operator Precedence and Associativity
Appendix C: Java Key Words
Appendix D: Installing the JDK and Using the JDK Documentation
Appendix E: Using the javadoc Utility
Appendix F: More about the Math Class
Appendix G: Packages
Appendix H: Working with Records and Random - Access Files
Appendix I: Configuring Java DB and Installing Apache Derby
Appendix J: The QuickSort Algorithm
Appendix K: Named Colors
Appendix L: Answers to Checkpoints
Appendix M: Answers to Odd-Numbered Review Questions
Online Chapters:
Chapter 17: A First look at GUI Applications
Chapter 18: Advanced GUI Applications
Chapter 19: Applets and More
Chapter 20: Creating GUI Applications with JavaFX and Scene Builder


















Online Case Studies:
Case Study 1: Calculating Sales Commission
Case Study 2: The Amortization Class
Case Study 3: The PinTester Class
Case Study 4: Parallel Arrays
Case Study 5: The FeetInches Class
Case Study 6: The SerialNumber Class
Case Study 7: A Simple Text Editor Application







Location of videonotes in the text
Chapter
1
Compiling and Running a Java Program, p. 14
Using an IDE, p. 14
Your First Java Program, p. 25
Chapter
2
Displaying Console Output, p. 33
Declaring Variables, p. 39
Simple Math Expressions, p. 55
The Miles-per-Gallon Problem, p. 107
Chapter
3
The if Statement, p. 111
The if-else Statement, p. 120
The if-else-if Statement, p. 129
The Time Calculator Problem, p. 182
Chapter
4
The while Loop, p. 193
The Pennies for Pay Problem, p. 263




Chapter
5
Passing Arguments to a Method, p. 279
Returning a Value from a Method, p. 293
The Retail Price Calculator Problem, p. 311
Chapter
6
Writing Classes and Creating Objects, p. 325
Initializing an Object with a Constructor, p. 346
The Personal Information Class Problem, p. 395
Chapter
7
Accessing Array Elements in a Loop, p. 407
Passing an Array to a Method, p. 422
The Charge Account Validation Problem, p. 487
Chapter
8
Returning Objects from Methods, p. 503
Aggregation, p. 515
The BankAccount , Class Copy Constructor Problem,
p. 552




Chapter
9
The Sentence Capitalizer Problem, p. 605
Chapter
10
Inheritance, p. 611
Polymorphism, p. 655
The Employee and Productionworker Classes
Problem, p. 696
Chapter
11
Handling Exceptions, p. 701
The Exception Project Problem, p. 757
Chapter
12
Introduction to JavaFX, p. 762
Creating Scenes, p. 765
Displaying Images, p. 772
The HBox Layout Container, p. 777
The VBox Layout Container, p. 782
The GridPane Layout Container, p. 784
Button Controls and Events, p. 792




The TextField Control, p. 799
Using Anonymous Inner Classes as Event Handlers, p.
803
Using Lambda Expressions as Event Handlers, p. 806
The Latin Translator Problem, p. 818
Chapter
13
JavaFX and CSS, p. 823
RadioButton Controls, p. 838
CheckBox Controls, p. 848
ListView Controls, p. 853
ComboBox Controls, p. 874
Slider Controls, p. 880
The Dorm and Meal Plan Calculator Problem, p. 906
Chapter
14
Drawing Shapes with JavaFX, p. 909
JavaFX Animation, p. 940
JavaFX Effects, p. 958


Playing Sound Files with JavaFX, p. 970
Playing Videos with JavaFX, p. 974
Handling Key Events in JavaFX, p. 979
Handling Mouse Events in JavaFX, p. 986
The Coin Toss Problem, p. 996
Chapter
15
Reducing a Problem with Recursion, p. 1003
The Recursive Power Problem, p. 1026
Chapter
16
The Customer Inserter Problem, p. 1107


Preface
Welcome to Starting Out with Java: From Control Structures through Objects,
Seventh Edition. This book is intended for a one-semester or a two-
quarter CS1 course. Although it is written for students with no prior
programming background, even experienced students will benefit from
its depth of detail.
Control Structures First, Then Objects
This text first introduces the student to the fundamentals of data types,
input and output, control structures, methods, and objects created from
standard library classes.
Next, the student learns to use arrays of primitive types and reference
types. After this, the student progresses through more advanced topics,
such as inheritance, polymorphism, the creation and management of
packages, GUI applications, recursion, and database programming. From
early in the book, applications are documented with javadoc comments.
As the student progresses through the text, new javadoc tags are covered
and demonstrated.
As with all the books in the Starting Out With … series, the hallmark of
this text is its clear, friendly, and easy-to-understand writing. In addition,
it is rich in example programs that are concise and practical.
Changes in the Seventh Edition
This book’s pedagogy, organization, and clear writing style remain the
same as in the previous edition. The most significant change in this
edition is the switch from Swing to JavaFX in the chapters that focus on
GUI development. Although Swing is not officially deprecated, Oracle has
announced that JavaFX has replaced Swing as the standard GUI library
for Java.
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6
In this edition, we have added the following new chapters:
CHAPTER 12 JAVAFX: GUI PROGRAMMING AND BASIC
CONTROLS This chapter presents the basics of developing graphical
user interface (GUI) applications with JavaFX. Fundamental controls,
layout containers, and the basic concepts of event-driven
programming are covered.
CHAPTER 13 JAVAFX: ADVANCED CONTROLS This chapter
discusses CSS styling and advanced user interface controls.
CHAPTER 14 JAVAFX: GRAPHICS, EFFECTS, AND MEDIA This
chapter discusses 2D shapes, animation, visual effects, playing audio
and video, and responding to mouse and keyboard events.
The Swing and Applet material that appeared in the previous edition is
still available on the book’s companion Web site, as the following online
chapters:
The previous Chapter 12 A First Look At GUI Applications is now
available online as Chapter 17 .
The previous Chapter 13 Advanced GUI Applications is now available
online as Chapter 18 .
1
1







The previous Chapter 14 Applets and More is now available online as
Chapter 19 .
Note: Chapter 15 from the previous edition has also been moved to the
book’s companion Web site as Chapter 20 Creating JavaFX Applications
with Scene Builder. Although Oracle no longer officially supports Scene
Builder, it is still available as an open source tool at
http://http://gluonhq.com/labs/scene-builder/
In addition to the new JavaFX chapters, the Database chapter, which is
now Chapter 15 , has been updated to use JavaFX instead of Swing for
its GUI applications. We have also added several new, motivational
programming problems throughout the book.
Organization of the Text
The text teaches Java step-by-step. Each chapter covers a major set of
topics and builds knowledge as students progress through the book.
Although the chapters can be easily taught in their existing sequence,
there is some flexibility. Figure P-1 shows chapter dependencies. Each
box represents a chapter or a group of chapters. An arrow points from a
chapter to the chapter that must be previously covered.






Figure P-1 Chapter dependencies
Another Random Scribd Document
with Unrelated Content
N. C. C. W.; A. B. U. N. C., 1920. Mathematics teacher in Wilson
High School, 1920-21; Salisbury High School, 1921-22.
Gattis, Alice Lee
Chapel Hill, N. C.
A. B. U. N. C., 1922.
Gattis, Lillian Foushee
Chapel Hill, N. C.
U. N. C., 1919—
Ghent, Marguerite
Dothan, Ala.
U. N. C., 1921—
Goforth, Caroline L.
318 McClintock Bldg., Denver, Colo.
Graduate N. C. C. W.; U. N. C., 1918-19; Columbia University
and National Training School of the Y. W. C. A., 1919-20. Taught
in Jamestown High School, 1917-18; student secretary, Y. W. C.
A., for colleges and universities in Utah, Kansas, Wyoming, and
Colorado.
Goforth, Willard
(Mrs. E. Eybers)
Stellenbasch Univ., Stellenbasch, South Africa
N. C. C. W., 1916-18; U. N. C., 1918-19; Barnard College, 1919-
20. Married July, 1920.
Graves, Mary DeBerniere
(Mrs. A. D. Rees)
308 Locust St., Philadelphia, Pa.
St. Mary’s School; Stuart Hall; U. N. C., 1905-06; Maryland
Institute; Academy of Fine Arts, Philadelphia. Advertising and
illustrating work for New York World and Judge; illustrated
articles in Saturday Magazine of New York Evening Post and
Sunday Tribune. Married Sept. 18, 1919; has one son, Arthur
Pembroke.
Greenlaw, Dorothy Durland
Chapel Hill, N. C.
U. N. C., 1918—
Grimes, Alice Dugger
(Mrs. Walter H.)
Raleigh, N. C.
Graduate St. Mary’s School; U. N. C., 1907-08. Has one son.
Ham, Mattie
(Mrs. J. A. McRae)
303 Monroe Road, Charlotte, N. C.
Law student U. N. C., 1914-15. Fourth woman lawyer to pass
Supreme Court examination. Practiced law several months. Was
married Jan. 22, 1916; has three children, two sons and one
daughter. Member D. A. R.
Hamilton, Martha Metzger
(Mrs. T. H.)
Chapel Hill, N. C.
U. N. C., 1921—
Hand, Erwin Robinson
(Mrs. J. K.)
Charlotte, N. C.
U. N. C., 1905-06.
Hankins, Melissa M.
4722 Springfield Ave., Philadelphia, Pa.
A. B. Salem College; U. N. C., 1920-21; now studying medicine
at University of Pennsylvania.
Harmon, Minnie Etta
Tazewell, Va.
A. B. Lynchburg College; U. N. C., 1921—
Harper, Alice Hermina
Address unknown.
Boston Univ.; U. N. C., 1906-07.
Harris, Julia Hamlet
Meredith College, Raleigh, N. C.
Graduate St. Mary’s School; Ph. B. U. N. C., 1905; A. M. Cornell
University; Ph. D. Yale University. In Department of English,
Meredith College.
Henderson, Curtis
Chapel Hill, N. C.
U. N. C., 1921—
Henderson, Mary Ferrand
Salisbury, N. C.
Graduate St. Mary’s School; law student U. N. C., 1915-16.
Hill, Annie Belle Howard
Jackson, Tenn.
B. L. Flora MacDonald; A. B. U. N. C., 1922.
Holland, Alma
Chapel Hill, N. C.
U. N. C., 1919-20. Assistant, Department of Botany, U. N. C.
Horsfield, Margaret Bennitt
218 E. Maxwell St., Lexington, Ky.
A. B. U. N. C., 1911; studied in Paris summer of 1913; Columbia
University, summer sessions 1917, 1918, 1921. Member faculty
Salem College, 1911-17; now instructor romance languages,
University of Kentucky.
Hooper, Caroline Alice
Hendersonville, N. C.
U. N. C., 1900-01. Teacher of French in Fassifern School.
Huffman, Willie Costner
(Mrs. E. W. G.)
Chapel Hill, N. C.
Lenoir College; N. C. C. W.; U. N. C., 1921—
Hughes, Adeline Edmonds
Henderson, N. C.
Graduate St. Mary’s School; A. B. U. N. C., 1921. Secretary to
the director, School of Public Welfare, U. N. C.
Hume, Mary Gregory
(Mrs. J. E. Mills)
Edgewood Arsenal, Edgewood, Md.
Hollins Institute; U. N. C., 1905-06. Taught in Birmingham, Ala.;
Asheville, N. C.; and Richmond, Va. Married October 15, 1921.
Author of a number of short stories in various magazines.
Jarman, Mary
(Mrs. T. A. Hearn)
18 Quinsan Road, Shanghai, China
A. B. U. N. C., 1911; graduate St. Luke’s Hospital, Jacksonville.
Established training school for nurses, Huchow, China. Married
December, 1918; has two sons. Editorial secretary, Nurses
Assoc, of China; editor bilingual Quarterly Journal for Chinese
Nurses.
Johnson, Annie Susan
(Mrs. W. R. Barber)
25 Boulevard, Whitestone, L. I., New York
U. N. C., 1904-06.
Johnston, Addie Louise
Mebane, N. C.
N. C. C. W.; U. N. C., 1919-20.
Jones, Alice Edwards
Chapel Hill, N. C.
Ph. B. U. N. C., 1900, A. M., 1904; Columbia University (summer
session); student in archaeology American Academy, Rome,
Italy, 1913-14. Taught Latin in St. Mary’s School and Winthrop
College; lady principal, St. Mary’s; associate principal, Catlin
School, Portland, Oreg.; dean, St. Mary’s College, Dallas, Tex.
Jones, Leah Donnell
(Mrs. L. J. Stevens)
New Berne, N. C.
U. N. C., 1899-1900. Married, 1907; has one son, John Duval.
Superintendent Public Welfare, Craven County.
Jones, Margaret Mordecai
(Mrs. Ernest Cruikshank)
Columbia, Tenn.
St. Mary’s School; U. N. C., 1900-01; B. S. and Teachers’
Diploma, Teachers College, Columbia University, 1911; studied
in Europe, 1907 and 1911. Taught mathematics in St. Mary’s
School and N. Y. City High School. Married June 7, 1911; has
three children, one son and two daughters.
Jones, Mary Best
(Mrs. Isaac H. Manning)
Chapel Hill, N. C.
Graduate N. C. C. W.; U. N. C., 1910-11. Teacher in public
schools of Goldsboro, Wilmington, and Chapel Hill. Married June
6 1911; has three sons. Author of Songs of the Seasons and a
number of short stories published in children’s papers. Member
of D. A. R. and Colonial Dames.
Joyner, Ruth Deans
(Mrs.)
308 Park Ave., Wilson, N. C.
A. B. N. C. C. W.; U. N. C., 1920-21.
Justice, Margaret Curtis
Chapel Hill, N. C.
Columbia University; U. N. C., 1921.
Kasey, Watson
(Mrs. Theodore H. Partrick)
Plymouth, N. C.
Stuart Hall; A. B. U. N. C., 1913. Taught in Salem College.
Kendrick, Mary Pearson
83 Elm St., Jamaica Plain, Boston, Mass.
A. B. Smith College; A. M. U. N. C., 1899.
Kennette, Ernestine
Chapel Hill, N. C.
Graduate N. C. C. W.; A. B. U. N. C., 1918. Doing secretarial
work, School of Education, U. N. C.
Lambertson, Brownie Augusta
(Mrs. ....................)
Address unknown.
U. N. C., 1903-06.
Latham, Marcia Louise
432 Central Park West, New York City
Ph. B. U. N. C., 1900.
Latshaw, Sylvia Louise
(Mrs. Harry F.)
Chapel Hill, N. C.
A. B. Flora Macdonald; A. B. in Educ. U. N. C., 1920, A. M. 1921.
Teacher in Chapel Hill High School.
Lawton, Beulah Scotte
89 Lawton St., Atlanta, Ga.
U. N. C., 1920-21. Playground director in Macon, Ga.; Y. W. C. A.
secretary in Parlin, N. J., and Greenville, S. C.; executive
secretary, American Red Cross, Gibson County, Tenn.
Lay, Elizabeth Atkinson
Chapel Hill, N. C.
Graduate St. Mary’s School; A. B. U. N. C., 1919, A. M., 1922.
Field agent, Bureau of Community Drama, University Extension
Division. Author of When Witches Ride, The Hag, Trista, and
several bulletins; joint author of Blackbeard: Pirate of the
Carolina Coast. One of the first and foremost workers in the
Carolina Playmakers. Her engagement to Paul E. Greene, ’21,
has just been announced.
Lay, Ellen Booth
Beaufort, N. C.
Graduate St. Mary’s School; A. B. U. N. C., 1922. Joint author of
In Dixon’s Kitchen, produced by the Carolina Playmakers.
Levis, Anna Conron
Govans, Md.
U. N. C., 1921—
Lewis, Callie Agnes
(Mrs. P. A. Reynolds)
132 Dunleith Ave., Winston-Salem, N. C.
A. B. U. N. C., 1917. Taught in Chapel Hill High School, 1917-18.
Married August 28, 1918. Has two daughters.
Liddell, Anna Forbes
600 East Ave., Charlotte, N. C.
A. B. U. N. C., 1918. With McGraw-Hill Pub. Co., New York,
1918-19; since then teacher of English in Salisbury High School.
Long, Ruth Virginia
Chapel Hill, N. C.
U. N. C., 1920-21.
Lynch, Margaret
(Mrs. C. L. Murphy)
Salisbury, N. C.
School of Pharmacy, U. N. C., 1916-17.
Lynch, Rachel
(Mrs. Eugene Simpson)
810 Cloverdale Ave., Winston-Salem, N. C.
B. Ped. N. C. C. W.; A. B. U. N. C., 1915. Taught in western N. C.
Married June 17, 1919. Has one daughter, Margaret Lynch.
MacDonald, Caroline
Goldsboro, N. C.
U. N. C., 1899-1900.
MacKenzie, Frances Elizabeth
Raleigh, N. C.
Law student U. N. C., 1918-20. After obtaining license practiced
a year in New Berne with Moore and Dunn; at present has her
own office in the Allen Building.
MacMillan, Genevieve
Red Springs, N. C.
A. B. Flora MacDonald; A. B. U. N. C., 1922.
MacRae, Mary Shackelford
(Mrs. R. L. Gray)
Durham, N. C.
U. N. C., 1897-98—the first woman to register in the University.
Has two sons and one daughter. Her eldest son has been in the
University for three years and her daughter is ready to enter the
freshman class.
McCarthy, Eleanor B.
2405 Grove Ave., Richmond, Va.
U. N. C., 1919-20. Laboratory technician Watts Hospital,
Durham, for one year.
McFadyen, Virginia Hendon
(Mrs. Edwin Bjorkman)
226 Fifth Ave., New York City
A. B. U. N. C., 1919. Taught school one year. Married, 1921.
Retains maiden name.
McGlamery, Winnie
Winthrop College, Rock Hill, S. C.
U. N. C., 1915-18; A. B. Goucher College, 1919. Secretary to the
president of Haverford College, 1919-20; taught at Mary
Baldwin Seminary, 1920-21; extension secretary, Winthrop
College, 1921-22.
McIver, Lula Martin
Spring Garden St., Greensboro, N. C.
Graduate N. C. C. W.; U. N. C., 1921-22.
McKie, Elizabeth Frances
Chapel Hill, N. C.
U. N. C., 1920—
McQueen, Anna
Address unknown.
U. N. C., 1902-03. Missionary in Korea.
Macon, Mary Litchford
2247 W. Thompson St., Philadelphia, Pa.
U. N. C., 1917-18, 1920 (spring term); student Woman’s Medical
College of Pennsylvania, taking the course for laboratory
technicians.
Matthews, Helen Ingram
Charlotte, N. C.
Erskine College; law student U. N. C., 1916-17.
Meares, Katherine DeRosset
Drawer B. Ridgeway, S. C.
Graduate St. Mary’s School; A. B. U. N. C., 1920; Columbia
University. Taught in high schools of Bennettsville and Anderson,
S. C., and Goldsboro, N. C.; head of Department of Latin,
Columbia College, Columbia, S. C.
Merritt, Bessie Lee
Chapel Hill, N. C.
Pharmacy student U. N. C., 1918-19. Secretary to chief, Bureau
of High School Debating and Athletics, University Extension
Division.
Merritt, Lena Evelyn
Burlington, N. C.
U. N. C., 1918-19.
Miller, Marion Spiers
Treasury Department, Washington, D. C.
A. B. U. N. C., 1918. In office of Register of the Treasury.
Miller, Mary Scales
War Department, Washington, D. C.
Queens College; A. B. U. N. C., 1916. In office of Adjutant
General.
Moore, Magnolia Arcena
(Mrs. J. S.)
Fremont, N. C.
U. N. C., 1919-20. Has three children.
Morris, Myrtle Estelle
Lubbock, Texas
A. M. U. N. C., 1918. Teaches in public schools during the school
year and spends summers on ranch.
Moses, Mildred
(Mrs. Louis Graves)
Chapel Hill, N. C.
N. C. C. W.; U. N. C., 1917-18. Taught in city schools in Wilson,
Morganton, Durham, and Chapel Hill; secretary to the librarian,
U. N. C., 1919. Married June 18, 1921.
Moss, Cora Jenkins
Franklinton, N. C.
A. B. Trinity College; U. N. C., 1921—
Moxley, Jane Elizabeth
90 High St., Nutley, N. J.
U. N. C., 1922.
Neal, Naomi
Mullins, S. C.
A. B. N. C. C. W.; U. N. C., 1921.
Neville, Grace Virginia
Chapel Hill, N. C.
Elon College; U. N. C., 1921—
Noa, Ernestine
Lookout Mountain, Tenn.
Completed special courses in Goucher College, Cleveland
Kindergarten College, Peabody College; U. N. C., 1914-15.
Assistant to Dr. E. C. Branson, U. N. C., 1915-20; at present
president Tenn. Woman’s Press and Author’s Club, and holding
office in a number of other local or state clubs.
Norburn, Martha Elizabeth
R. F. D. Box 4, Candler, N. C.
U. N. C., 1919-20.
Odom, Helen Louise
1519 Park Ave., Baltimore, Md.
U. N. C., 1900-02. After doing some tutoring took up secretarial
work; with War Department, 1918-21; now chief clerk Md. State
Board of Motion Picture Censors.
Odum, Ana Kranz
(Mrs. H. W.)
Chapel Hill, N. C.
A. M. Clarke University; U. N. C., 1921—
Palmer, Madeline Elizabeth
(Mrs. Edmund McRary)
Charlotte, N. C.
LL. B. U. N. C., 1919.
Parker, Julia Piccola
New Berne, N. C.
Trinity College; U. N. C., 1921—
Pasmore, Julia C.
Cary, N. C.
Graduate N. C. C. W.; A. B. U. N. C., 1918.
Patterson, Harriet Oldring
(Mrs. F. E. Bel)
162 Beacon St., Hartford, Conn.
U. N. C., 1913-14.
Peele, Rennie
Clarksville, Va.
A. B. U. N. C., 1915; Columbia University (summer session),
1919; Harvard University (summer session), 1921. Taught in
Burgaw, N. C., 1911-13; in Florida, 1913-18; now teaching
English in Goldsboro High School. President State Council of
English Teachers, 1921.
Pelton, Mabell Shippie Clarke
(Mrs. J. Ravenel Smith)
39 East 10th St., New York City
A. B. Boston University; A. M. U. N. C., 1905. Married October,
1907. Author of A Tar Heel Baron, The Spirit of French Letters,
Twenty Centuries of Paris, Ethel Morton Books. Member D. A. R.,
Soc. Mayflower Descendants, Colonial Dames, Phi Beta Kappa.
Pendergraft, Pearl
Chapel Hill, N. C.
U. N. C., 1919—
Penn, May Belle
819 N. Elm St., Greensboro, N. C.
N. C. C. W.; U. N. C., 1921—
Penny, Ruth
(Mrs. H. C. Heffner)
Maiden, N. C.
A. B. U. N. C., 1921. Taught in Cornelius High School Sept.,
Dec., 1921. Married April 8, 1922.
Perry, Margaret Gray
Wilkesboro, N. C.
Graduate N. C. C. W.; A. M. U. N. C., 1920. Teacher.
Pickard, Nell A. P.
Chapel Hill, N. C.
A. B. U. N. C., 1921. Teacher in Durham High School.
Pickard, Minna Thelma
Elizabeth City, N. C.
A. B. U. N. C., 1917. Taught in Lexington High School 1917-
1918; since then teacher of science Elizabeth City High School.
Pollock, M. Keatinge
Chapel Hill, N. C.
U. N. C., 1921—
Price, Mildred
Chapel Hill, N. C.
N. C. C. W.; A. B. U. N. C., 1922.
Pritchard, Birdie
(Mrs. R. O. E. Davis)
1425 Crittenden St., N. W., Washington, D. C.
Ph. B. U. N. C., 1902. Married 1905. Two years in associated
charity work in Washington; now detail clerk, Veterans’ Bureau.
Pritchard, Maude
(Mrs. A. B. Bristow)
Palisade Apt., W. Ghent Blvd., Norfolk, Va.
A. B. Elon College; A. M. U. N. C., Taught in Waverley, Va.; City
Point. Married August 16, 1916. Principal Carson High School.
Pritchard, Vera
Chapel Hill, N. C.
Elon College; A. B. U. N. C., 1920. Taught in Cherryville schools,
1921-22.
Pruden, Lina Tucker
Edenton, N. C.
N. C. C. W.; A. B. U. N. C., 1922.
Pruitt, Annie
R. F. D. No. 1, Stem, N. C.
A. B. U. N. C., 1921.
Puett, Anna Mariah
317 Tarboro St., Rocky Mount, N. C.
A. B. Chicora College; A. B. U. N. C., 1914. Has taught ever
since leaving University, spending the summers usually in some
summer school or in traveling; is at present teaching
mathematics in the Rocky Mount High School.
Rankin, Kathleen Adair
(Mrs. Will Moore)
Gastonia, N. C.
U. N. C., 1900-01.
Reid, Louisa Pressly
307 S. Broad Street, Gastonia, N. C.
A. B. Queens College, 1917; A. B. U. N. C., 1918, and A. M.,
1921. Taught romance languages in Peace Institute, 1919-1920;
Chapel Hill High School, 1920-21; Gastonia, 1921-22.
Richardson, Helen
St. Martinville, La.
U. N. C., 1920-21. In government service during the war;
secretary, St. Martinville Chapter American Red Cross.
Roberson, Mary
(Mrs. Roy Mason)
139 E. 66th St., New York City
U. N. C., 1916-17. Nurse’s Training course U. P. I., Baltimore.
Married April 6, 1918.
Roberson, Nellie
Chapel Hill, N. C.
Woman’s College, Richmond, Va.; A. B. U. N. C., 1921. Chief of
the Bureau of Public Discussion, University Extension Division.
Robinson, Kathrine Mcdiarmid
Fayetteville, N. C.
N. C. C. W.; Washington College of Law; LL. B. U. N. C., 1920.
In government service 1918-19; now attorney at law in
partnership with her father.
Rodman, Pearl
Waxhaw, N. C.
U. N. C., 1900-01.
Rosemond, Thelma Marie
Hillsboro, N. C.
U. N. C., 1922.
Russell, Dorothy
Chapel Hill, N. C.
U. N. C., 1921—
Savley, Eva Davis
(Mrs.)
Clearwater Lighting Co., Clearwater, Fla.
U. N. C., 1920-21.
Scales, Elizabeth Walker
(Mrs. V. S. Bryant, Jr.)
Durham, N. C.
A. B. Converse College; U. N. C., 1917-18. Married February,
1921.
Scott, Rosa Naomi
U. N. C., 1908-09.
Sherrill, Mildred Irene
Newton, N. C.
A. B. Catawba College; A. B. U. N. C., 1920. Taught science in
Henderson High School, 1920-21; teacher in Catawba College
Academy.
Shine, Claudia
(Mrs. Lee J.)
Chapel Hill, N. C.
U. N. C., 1919-20. Has a son and a daughter, both alumni of the
University.
Shine, Lou
Chapel Hill, N. C.
A. B. U. N. C., 1921. Teacher in Elizabeth City schools.
Sloan, Isabel
Address unknown.
Davidson College; A. B. U. N. C., 1917.
Smith, Annie T.
Durham, N. C.
B. S. in medicine, U. N. C., 1920.
Smith, Mattie Elizabeth
Marshville, N. C.
Pharmacy student U. N. C., 1921—
Snyder, Ethel
(Mrs. W. O. Seymour)
Monroe, N. C.
Chowan College, 1915-18; U. N. C., 1918-19. Married Sept. 29,
1919.
Sparrow, Minnie Shepherd
(Mrs. C. W. Keyes)
404 W. 115th St., New York City
A. M. U. N. C., 1919. Married September, 1920.
Spruill, Mary James
Littleton, N. C.
Graduate St. Mary’s School; Barnard College; A. B. U. N. C.,
1921; A. M., 1922.
Stacy, Mary Martha
(Mrs. Will Dozier)
Huntsboro, Ala.
U. N. C., 1911-12.
Staley, Bessie

More Related Content

PDF
Starting Out With Java From Control Structures Through Objects 7e Tony Gaddis
PDF
Starting Out With Java From Control Structures Through Objects 7th Edition To...
PDF
Using MIS 9th Edition – Ebook PDF Version
PDF
Microsoft Visual C# Step by Step 10th Edition John Sharp
PDF
Microsoft Visual C# Step by Step 10th Edition John Sharp
PDF
(eBook PDF) Using MIS 9th Edition by David M. Kroenke
PDF
Using MIS 9th Edition – Ebook PDF Version
PDF
(eBook PDF) Using MIS 9th Edition by David M. Kroenke
Starting Out With Java From Control Structures Through Objects 7e Tony Gaddis
Starting Out With Java From Control Structures Through Objects 7th Edition To...
Using MIS 9th Edition – Ebook PDF Version
Microsoft Visual C# Step by Step 10th Edition John Sharp
Microsoft Visual C# Step by Step 10th Edition John Sharp
(eBook PDF) Using MIS 9th Edition by David M. Kroenke
Using MIS 9th Edition – Ebook PDF Version
(eBook PDF) Using MIS 9th Edition by David M. Kroenke

Similar to Starting Out with Java From control structures through Objects 7th Edition Tony Gaddis (20)

DOCX
Deitel® Series PageHow To Program SeriesAn.docx
PDF
Android Pocket Primer Papcdr Oswald Campesato
PDF
Fintech Fundamentals 1st Edition Len Mei Phd
PDF
Professional Java Programming JDK 5 5th Edition W. Clay Richardson
PDF
Microsoft Visual C Step By Step Ninth Edition John Sharp
DOCX
Business intelligence and analyticssystems for dec
PDF
(eBook PDF) Systems Analysis and Design 10th by Kenneth E. Kendall
PDF
Professional Dotnetnuke Aspnet Portals Shaun Walker Patrick J Santry
PDF
(eBook PDF) Systems Analysis and Design 10th by Kenneth E. Kendall
PDF
HUMAN-TECHNOLOGY COMMUNICATION internet-of robotic-things and ubiquitous. R. ...
PDF
Clean Architecture With Net For True Epub Dino Esposito
PDF
Mastering ASP NET with Visual C 1st Edition A. Russell Jones
PDF
C Programming Fundamentals Dheeraj Malhotra Neha Malhotra
PDF
Smarter Documentation: Shedding Light on the Black Box of Reporting Data
PDF
Coldfusion 8 Developer Tutorial John Farrar
PDF
Improving Code Quality 1st Edition Yiannis Kanellopoulos & Tim Walker
DOCX
Chapter 10 Modeling and Analysis Heuristic Search Methods
DOCX
Editor in Chief Stephanie Wall Executive Editor Bo.docx
DOCX
Editor in Chief Stephanie Wall Executive Editor Bo
PDF
Applications Of Blockchain And Big Iot Systems Digital Solutions For Diverse ...
Deitel® Series PageHow To Program SeriesAn.docx
Android Pocket Primer Papcdr Oswald Campesato
Fintech Fundamentals 1st Edition Len Mei Phd
Professional Java Programming JDK 5 5th Edition W. Clay Richardson
Microsoft Visual C Step By Step Ninth Edition John Sharp
Business intelligence and analyticssystems for dec
(eBook PDF) Systems Analysis and Design 10th by Kenneth E. Kendall
Professional Dotnetnuke Aspnet Portals Shaun Walker Patrick J Santry
(eBook PDF) Systems Analysis and Design 10th by Kenneth E. Kendall
HUMAN-TECHNOLOGY COMMUNICATION internet-of robotic-things and ubiquitous. R. ...
Clean Architecture With Net For True Epub Dino Esposito
Mastering ASP NET with Visual C 1st Edition A. Russell Jones
C Programming Fundamentals Dheeraj Malhotra Neha Malhotra
Smarter Documentation: Shedding Light on the Black Box of Reporting Data
Coldfusion 8 Developer Tutorial John Farrar
Improving Code Quality 1st Edition Yiannis Kanellopoulos & Tim Walker
Chapter 10 Modeling and Analysis Heuristic Search Methods
Editor in Chief Stephanie Wall Executive Editor Bo.docx
Editor in Chief Stephanie Wall Executive Editor Bo
Applications Of Blockchain And Big Iot Systems Digital Solutions For Diverse ...
Ad

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Cell Structure & Organelles in detailed.
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
01-Introduction-to-Information-Management.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
O5-L3 Freight Transport Ops (International) V1.pdf
Insiders guide to clinical Medicine.pdf
Cell Types and Its function , kingdom of life
Anesthesia in Laparoscopic Surgery in India
Cell Structure & Organelles in detailed.
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
GDM (1) (1).pptx small presentation for students
human mycosis Human fungal infections are called human mycosis..pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pharma ospi slides which help in ospi learning
01-Introduction-to-Information-Management.pdf
Pre independence Education in Inndia.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Microbial disease of the cardiovascular and lymphatic systems
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Ad

Starting Out with Java From control structures through Objects 7th Edition Tony Gaddis

  • 1. Starting Out with Java From control structures through Objects 7th Edition Tony Gaddis install download https://ebookmeta.com/product/starting-out-with-java-from- control-structures-through-objects-7th-edition-tony-gaddis/ Download more ebook from https://ebookmeta.com
  • 2. We believe these products will be a great fit for you. Click the link to download now, or visit ebookmeta.com to discover even more! Starting Out with C++ - From Control Structures through Objects 9th Edition Tony Gaddis https://ebookmeta.com/product/starting-out-with-c-from-control- structures-through-objects-9th-edition-tony-gaddis/ Starting Out with Visual Basic - 8th Edition Tony Gaddis https://ebookmeta.com/product/starting-out-with-visual-basic-8th- edition-tony-gaddis/ Starting out with Visual C# 5th Edition Tony Gaddis https://ebookmeta.com/product/starting-out-with-visual-c-5th- edition-tony-gaddis/ Print Culture and the Formation of the Anarchist Movement in Spain 1890 1915 1st Edition James Michael Yeoman https://ebookmeta.com/product/print-culture-and-the-formation-of- the-anarchist-movement-in-spain-1890-1915-1st-edition-james- michael-yeoman/
  • 3. Identity Configuration of the Russian Youth monograph 1st Edition Zinurova https://ebookmeta.com/product/identity-configuration-of-the- russian-youth-monograph-1st-edition-zinurova/ Best Hikes Los Angeles The Greatest Trails in the La Mountains Beaches and Canyons 2nd Edition Allen Riedel Monique Riedel https://ebookmeta.com/product/best-hikes-los-angeles-the- greatest-trails-in-the-la-mountains-beaches-and-canyons-2nd- edition-allen-riedel-monique-riedel/ Encounters with the Real in Contemporary Italian Literature and Cinema 1st Edition Loredana Di Martino https://ebookmeta.com/product/encounters-with-the-real-in- contemporary-italian-literature-and-cinema-1st-edition-loredana- di-martino/ Next Door Blake Pierce https://ebookmeta.com/product/next-door-blake-pierce/ A Best Practice Guide to Sex and Storytelling Filming Scenes with Sex and Nudity 1st Edition John Bucher https://ebookmeta.com/product/a-best-practice-guide-to-sex-and- storytelling-filming-scenes-with-sex-and-nudity-1st-edition-john- bucher/
  • 4. An Artist s Guide to Programming Jim Parker https://ebookmeta.com/product/an-artist-s-guide-to-programming- jim-parker/
  • 7. Starting Out With Java ™ From Control Structures through Objects
  • 8. Starting Out With Java ™ From Control Structures through Objects SEVENTH EDITION Tony Gaddis Haywood Community College 330 Hudson Street, NY NY 10013
  • 9. Senior Vice President Courseware Portfolio Management: Marcia J. Horton Director, Portfolio Management: Engineering, Computer Science & Global Editions: Julian Partridge Portfolio Manager: Matt Goldstein Portfolio Management Assistant: Meghan Jacoby Managing Content Producer: Scott Disanno Content Producer: Amanda Brands Rights and Permissions Manager: Ben Ferrini Manufacturing Buyer, Higher Ed, Lake Side Communications, Inc. (LSC): Maura Zaldivar-Garcia Inventory Manager: Ann Lam Product Marketing Manager: Yvonne Vannatta Field Marketing Manager: Demetrius Hall Marketing Assistant: Jon Bryant Cover Designer: Joyce Wells Cover Photo: Shutterstock/Tim UR Printer/Binder: LSC Communications, Inc. Full-Service Project Management: Sasibalan Chidambaram, SPi Global Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on appropriate page within text. Copyright © 2019, 2016, 2013 by Pearson Education, Inc., Hoboken, New Jersey 07030. All rights reserved. Manufactured in the United States of America. This publication is protected by copyright and permissions should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or
  • 10. likewise. For information regarding permissions, request forms and the appropriate contacts within the Pearson Education Global Rights & Permissions department, please visit http://www.pearsoned.com/ permissions/. Many of the designations by manufacturers and seller to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps. Unless otherwise indicated herein, any third-party trademarks that may appear in this work are the property of their respective owners and any references to third-party trademarks, logos or other trade dress are for demonstrative or descriptive purposes only. Such references are not intended to imply any sponsorship, endorsement, authorization, or promotion of Pearson’s products by the owners of such marks, or any relationship between the owner and Pearson Education, Inc. or its affiliates, authors, licensees or distributors. Microsoft and/or its respective suppliers make no representations about the suitability of the information contained in the documents and related graphics published as part of the services for any purpose. All such documents and related graphics are provided “as is” without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties and conditions with regard to this information, including all warranties and conditions of merchantability. Whether express, implied or statutory, fitness for a particular purpose, title and non infringement. In no event shall microsoft and/or its respective suppliers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract. Negligence or other tortious action, arising out of or in
  • 11. connection with the use or performance of information available from the services. The documents and related graphics contained herein could include technical inaccuracies or typographical errors changes are periodically added to the information herein. Microsoft and/or its respective suppliers may make improvements and/or changes in the product(s) and/or the program(s) described herein at any time partial screen shots may be viewed in full within the software version specified. Microsoft Windows , and Microsoft Office are registered trademarks of the Microsoft Corporation in the U.S.A. and other countries. This book is not sponsored or endorsed by or affiliated with the Microsoft Corporation. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Library of Congress Cataloging-in-Publication Data Names: Gaddis, Tony, author. Title: Starting out with Java. From control structures through objects / Tony Gaddis, Haywood Community College. Description: Seventh edition. | NY, NY : Pearson Education, Inc., [2019] | Includes index. Identifiers: LCCN 2017060354| ISBN 9780134802213 | ISBN 0134802217 Subjects: LCSH: Java (Computer program language) | Data structures (Computer science) | Object-oriented programming (Computer science) ® ® ®
  • 12. Classification: LCC QA76.73.J38 G333 2019 | DDC 005.13/3--dc23 LC record available at https://lccn.loc.gov/2017060354 1 18 ISBN 10: 0-13-480221-7 ISBN 13: 978-0-13-480221-3
  • 13. Contents in Brief Chapter 1 Introduction to Computers and Java 1 Chapter 2 Java Fundamentals 27 Chapter 3 Decision Structures 111 Chapter 4 Loops and Files 189 Chapter 5 Methods 269 Chapter 6 A First Look at Classes 317 Chapter 7 Arrays and the ArrayList Class 403 Chapter 8 A Second Look at Classes and Objects 493 Chapter 9 Text Processing and More about Wrapper Classes 557 Chapter 10 Inheritance 611 Chapter 11 Exceptions and Advanced File I/O 701 Chapter 12 JavaFX: GUI Programming and Basic Controls 759 Chapter 13 JavaFX: Advanced Controls 823 Chapter 14 JavaFX: Graphics, Effects, and Media 909 Chapter 15 Recursion 999 Chapter 16 Databases 1027 Index 1109 Appendices A–M Companion Website Case Studies 1–7 Companion Website                 
  • 15. Contents Preface xxiii Chapter 1 Introduction to Computers and Java 1 1.1 Introduction 1 1.2 Why Program? 1 1.3 Computer Systems: Hardware and Software 2 Hardware 2 Software 5 1.4 Programming Languages 6 What Is a Program? 6 A History of Java 8 1.5 What Is a Program Made Of? 8 Language Elements 8 Lines and Statements 11 Variables 11 The Compiler and the Java Virtual Machine 12 Java Software Editions 13 Compiling and Running a Java Program 14 1.6 The Programming Process 16 Software Engineering 18 1.7 Object-Oriented Programming 19 Review Questions and Exercises 21                     
  • 16. Programming Challenge 25 Chapter 2 Java Fundamentals 27 2.1 The Parts of a Java Program 27 2.2 The print and println Methods, and the Java API 33 2.3 Variables and Literals 39 Displaying Multiple Items with the Operator 40 Be Careful with Quotation Marks 41 More about Literals 42 Identifiers 42 Class Names 44 2.4 Primitive Data Types 44 The Integer Data Types 46 Floating-Point Data Types 47 The boolean Data Type 50 The char Data Type 50 Variable Assignment and Initialization 52 Variables Hold Only One Value at a Time 53 2.5 Arithmetic Operators 54 Integer Division 57 Operator Precedence 57 Grouping with Parentheses 59 The Math Class 62 2.6 Combined Assignment Operators 63      +                  
  • 17. 2.7 Conversion between Primitive Data Types 65 Mixed Integer Operations 67 Other Mixed Mathematical Expressions 68 2.8 Creating Named Constants with final 69 2.9 The String Class 70 Objects Are Created from Classes 71 The String Class 71 Primitive Type Variables and Class Type Variables 71 Creating a String Object 72 2.10 Scope 76 2.11 Comments 78 2.12 Programming Style 83 2.13 Reading Keyboard Input 85 Reading a Character 89 Mixing Calls to nextLine with Calls to Other Scanner Methods 89 2.14 Dialog Boxes 93 Displaying Message Dialogs 93 Displaying Input Dialogs 94 An Example Program 94 Converting String Input to Numbers 96 2.15 Common Errors to Avoid 99 Review Questions and Exercises 100 Programming Challenges 106                       
  • 18. Chapter 3 Decision Structures 111 3.1 The if Statement 111 Using Relational Operators to Form Conditions 113 Putting It All Together 114 Programming Style and the if Statement 117 Be Careful with Semicolons 117 Having Multiple Conditionally Executed Statements 118 Flags 118 Comparing Characters 119 3.2 The if-else Statement 120 3.3 Nested if Statements 122 3.4 The if-else-if Statement 128 3.5 Logical Operators 134 The Precedence of Logical Operators 139 Checking Numeric Ranges with Logical Operators 140 3.6 Comparing String Objects 142 Ignoring Case in String Comparisons 146 3.7 More about Variable Declaration and Scope 147 3.8 The Conditional Operator (Optional) 149 3.9 The switch Statement 150 3.10 Displaying Formatted Output with System.out.printf and String.format 160 Format Specifier Syntax 163                      
  • 19. Precision 164 Specifying a Minimum Field Width 164 Flags 167 Formatting String Arguments 170 The String.format Method 172 3.11 Common Errors to Avoid 174 Review Questions and Exercises 175 Programming Challenges 181 Chapter 4 Loops and Files 189 4.1 The Increment and Decrement Operators 189 The Difference between Postfix and Prefix Modes 192 4.2 The while Loop 193 The while Loop Is a Pretest Loop 196 Infinite Loops 196 Don’t Forget the Braces with a Block of Statements 197 Programming Style and the while Loop 198 4.3 Using the while Loop for Input Validation 200 4.4 The do-while Loop 204 4.5 The for Loop 207 The for Loop Is a Pretest Loop 210 Avoid Modifying the Control Variable in the Body of the for Loop 211 Other Forms of the Update Expression 211 Declaring a Variable in the for Loop’s Initialization Expression 211                       
  • 20. Creating a User Controlled for Loop 212 Using Multiple Statements in the Initialization and Update Expressions 213 4.6 Running Totals and Sentinel Values 216 Using a Sentinel Value 219 4.7 Nested Loops 221 4.8 The break and continue Statements (Optional) 229 4.9 Deciding Which Loop to Use 229 4.10 Introduction to File Input and Output 230 Using the PrintWriter Class to Write Data to a File 230 Appending Data to a File 236 Specifying the File Location 237 Reading Data from a File 237 Reading Lines from a File with the nextLine Method 238 Adding a throws Clause to the Method Header 241 Checking for a File’s Existence 245 4.11 Generating Random Numbers with the Random Class 249 4.12 Common Errors to Avoid 255 Review Questions and Exercises 256 Programming Challenges 262 Chapter 5 Methods 269 5.1 Introduction to Methods 269 void Methods and Value-Returning Methods 270 Defining a void Method 271                       
  • 21. Calling a Method 272 Layered Method Calls 276 Using Documentation Comments with Methods 277 5.2 Passing Arguments to a Method 279 Argument and Parameter Data Type Compatibility 281 Parameter Variable Scope 282 Passing Multiple Arguments 282 Arguments Are Passed by Value 284 Passing Object References to a Method 285 Using the @param Tag in Documentation Comments 288 5.3 More about Local Variables 290 Local Variable Lifetime 292 Initializing Local Variables with Parameter Values 292 5.4 Returning a Value from a Method 293 Defining a Value-Returning Method 293 Calling a Value-Returning Method 294 Using the @return Tag in Documentation Comments 296 Returning a boolean Value 300 Returning a Reference to an Object 300 5.5 Problem Solving with Methods 302 Calling Methods That Throw Exceptions 305 5.6 Common Errors to Avoid 305 Review Questions and Exercises 306                       
  • 22. Programming Challenges 311 Chapter 6 A First Look at Classes 317 6.1 Objects and Classes 317 Classes: Where Objects Come From 318 Classes in the Java API 319 Primitive Variables vs. Objects 321 6.2 Writing a Simple Class, Step by Step 324 Accessor and Mutator Methods 338 The Importance of Data Hiding 338 Avoiding Stale Data 339 Showing Access Specification in UML Diagrams 339 Data Type and Parameter Notation in UML Diagrams 339 Layout of Class Members 340 6.3 Instance Fields and Methods 341 6.4 Constructors 346 Showing Constructors in a UML Diagram 348 Uninitialized Local Reference Variables 348 The Default Constructor 348 Writing Your Own No-Arg Constructor 349 The String Class Constructor 350 6.5 Passing Objects as Arguments 358 6.6 Overloading Methods and Constructors 370 The BankAccount Class 372                       
  • 23. Overloaded Methods Make Classes More Useful 378 6.7 Scope of Instance Fields 378 Shadowing 379 6.8 Packages and import Statements 380 Explicit and Wildcard import Statements 380 The java.lang Package 381 Other API Packages 381 6.9 Focus on Object-Oriented Design: Finding the Classes and Their Responsibilities 382 Finding the Classes 382 Identifying a Class’s Responsibilities 385 This Is Only the Beginning 388 6.10 Common Errors to Avoid 388 Review Questions and Exercises 389 Programming Challenges 394 Chapter 7 Arrays and the ArrayList Class 403 7.1 Introduction to Arrays 403 Accessing Array Elements 405 Inputting and Outputting Array Contents 406 Java Performs Bounds Checking 409 Watch Out for Off-by-One Errors 410 Array Initialization 411 Alternate Array Declaration Notation 412                      
  • 24. 7.2 Processing Array Elements 413 Array Length 415 The Enhanced for Loop 416 Letting the User Specify an Array’s Size 417 Reassigning Array Reference Variables 419 Copying Arrays 420 7.3 Passing Arrays as Arguments to Methods 422 7.4 Some Useful Array Algorithms and Operations 426 Comparing Arrays 426 Summing the Values in a Numeric Array 427 Getting the Average of the Values in a Numeric Array 428 Finding the Highest and Lowest Values in a Numeric Array 428 The SalesData Class 429 Partially Filled Arrays 437 Working with Arrays and Files 438 7.5 Returning Arrays from Methods 439 7.6 String Arrays 441 Calling String Methods from an Array Element 443 7.7 Arrays of Objects 444 7.8 The Sequential Search Algorithm 447 7.9 Two-Dimensional Arrays 450 Initializing a Two-Dimensional Array 454 The length Field in a Two-Dimensional Array 455                       
  • 25. Displaying All the Elements of a Two-Dimensional Array 457 Summing All the Elements of a Two-Dimensional Array 457 Summing the Rows of a Two-Dimensional Array 458 Summing the Columns of a Two-Dimensional Array 458 Passing Two-Dimensional Arrays to Methods 459 Ragged Arrays 461 7.10 Arrays with Three or More Dimensions 462 7.11 The Selection Sort and the Binary Search Algorithms 463 The Selection Sort Algorithm 463 The Binary Search Algorithm 466 7.12 Command-Line Arguments and Variable-Length Argument Lists 468 Command-Line Arguments 469 Variable-Length Argument Lists 470 7.13 The ArrayList Class 472 Creating and Using an ArrayList Object 473 Using the Enhanced for Loop with an ArrayList 474 The ArrayList Class’s toString method 475 Removing an Item from an ArrayList 476 Inserting an Item 477 Replacing an Item 478 Capacity 479 Storing Your Own Objects in an ArrayList 479                      
  • 26. Using the Diamond Operator for Type Inference 480 7.14 Common Errors to Avoid 481 Review Questions and Exercises 481 Programming Challenges 486 Chapter 8 A Second Look at Classes and Objects 493 8.1 Static Class Members 493 A Quick Review of Instance Fields and Instance Methods 493 Static Members 494 Static Fields 494 Static Methods 497 8.2 Passing Objects as Arguments to Methods 500 8.3 Returning Objects from Methods 503 8.4 The toString Method 505 8.5 Writing an equals Method 509 8.6 Methods That Copy Objects 512 Copy Constructors 514 8.7 Aggregation 515 Aggregation in UML Diagrams 523 Security Issues with Aggregate Classes 523 Avoid Using null References 525 8.8 The this Reference Variable 528 Using this to Overcome Shadowing 529                      
  • 27. Using this to Call an Overloaded Constructor from Another Constructor 530 8.9 Enumerated Types 531 Enumerated Types Are Specialized Classes 532 Switching On an Enumerated Type 538 8.10 Garbage Collection 540 The finalize Method 542 8.11 Focus on Object-Oriented Design: Class Collaboration 542 Determining Class Collaborations with CRC Cards 545 8.12 Common Errors to Avoid 546 Review Questions and Exercises 547 Programming Challenges 551 Chapter 9 Text Processing and More about Wrapper Classes 557 9.1 Introduction to Wrapper Classes 557 9.2 Character Testing and Conversion with the Character Class 558 Character Case Conversion 563 9.3 More String Methods 566 Searching for Substrings 566 Extracting Substrings 572 Methods That Return a Modified String 576 The Static valueOf Methods 577 9.4 The StringBuilder Class 579 The StringBuilder Constructors 580 Other StringBuilder Methods 581                       
  • 28. The toString Method 584 9.5 Tokenizing Strings 589 9.6 Wrapper Classes for the Numeric Data Types 594 The Static toString Methods 594 The toBinaryString , toHexString , and toOctalString Methods 594 The MIN_VALUE and MAX_VALUE Constants 595 Autoboxing and Unboxing 595 9.7 Focus on Problem Solving: The TestScoreReader Class 597 9.8 Common Errors to Avoid 601 Review Questions and Exercises 601 Programming Challenges 605 Chapter 10 Inheritance 611 10.1 What Is Inheritance? 611 Generalization and Specialization 611 Inheritance and the “Is a” Relationship 612 Inheritance in UML Diagrams 620 The Superclass’s Constructor 621 Inheritance Does Not Work in Reverse 623 10.2 Calling the Superclass Constructor 624 When the Superclass Has No Default or No-Arg Constructors 630 Summary of Constructor Issues in Inheritance 631 10.3 Overriding Superclass Methods 632                      
  • 29. Overloading versus Overriding 637 Preventing a Method from Being Overridden 640 10.4 Protected Members 641 Package Access 646 10.5 Chains of Inheritance 647 Class Hierarchies 653 10.6 The Object Class 653 10.7 Polymorphism 655 Polymorphism and Dynamic Binding 656 The “Is-a” Relationship Does Not Work in Reverse 658 The instanceof Operator 659 10.8 Abstract Classes and Abstract Methods 660 Abstract Classes in UML 666 10.9 Interfaces 667 An Interface is a Contract 669 Fields in Interfaces 673 Implementing Multiple Interfaces 673 Interfaces in UML 673 Default Methods 674 Polymorphism and Interfaces 676 10.10 Anonymous Inner Classes 681 10.11 Functional Interfaces and Lambda Expressions 684 10.12 Common Errors to Avoid 689                       
  • 30. Review Questions and Exercises 690 Programming Challenges 696 Chapter 11 Exceptions and Advanced File I/O 701 11.1 Handling Exceptions 701 Exception Classes 702 Handling an Exception 703 Retrieving the Default Error Message 707 Polymorphic References to Exceptions 710 Using Multiple catch Clauses to Handle Multiple Exceptions 710 The finally Clause 718 The Stack Trace 720 Handling Multiple Exceptions with One catch Clause 721 When an Exception Is Not Caught 723 Checked and Unchecked Exceptions 724 11.2 Throwing Exceptions 725 Creating Your Own Exception Classes 728 Using the @exception Tag in Documentation Comments 731 11.3 Advanced Topics: Binary Files, Random Access Files, and Object Serialization 732 Binary Files 732 Random Access Files 739 Object Serialization 744 Serializing Aggregate Objects 748                      
  • 31. 11.4 Common Errors to Avoid 749 Review Questions and Exercises 749 Programming Challenges 755 Chapter 12 JavaFX: GUI Programming and Basic Controls 759 12.1 Graphical User Interfaces 759 Event-Driven GUI Programs 761 12.2 Introduction to JavaFX 762 Controls 762 Stages and Scenes 763 The Application Class 763 12.3 Creating Scenes 765 Creating Controls 766 Creating Layout Containers 766 Creating a Scene Object 767 Adding the Scene Object to the Stage 768 Setting the Size of the Scene 770 Aligning Controls in an HBox Layout Container 770 12.4 Displaying Images 772 Loading Images from an Internet Location 775 Setting the Size of an Image 775 Preserving the Image’s Aspect Ratio 775 Changing an ImageView’s Image 776 12.5 More about the HBox, VBox , and GridPane Layout Containers 776                       
  • 32. The HBox Layout Container 777 The VBox Layout Container 782 The GridPane Layout Container 784 Using Multiple Layout Containers in the Same Screen 791 12.6 Button Controls and Events 792 Handling Events 794 Writing Event Handlers 794 Registering an Event Handler 795 12.7 Reading Input with TextField Controls 799 12.8 Using Anonymous Inner Classes and Lambda Expressions to Handle Events 803 Using Anonymous Inner Classes to Create Event Handlers 803 Using Lambda Expressions to Create Event Handlers 806 12.9 The BorderPane Layout Container 808 12.10 The ObservableList Interface 812 12.11 Common Errors to Avoid 814 Review Questions and Exercises 814 Programming Challenges 818 Chapter 13 JavaFX: Advanced Controls 823 13.1 Styling JavaFX Applications with CSS 823 Type Selector Names 824 Style Properties 825 Applying a Stylesheet to a JavaFX Application 826                      
  • 33. Applying Styles to the Root Node 830 Specifying Multiple Selectors in the Same Style Definition 832 Working with Colors 832 Creating a Custom Style Class Name 834 ID Selectors 836 Inline Style Rules 837 13.2 RadioButton Controls 838 Determining in Code Whether a RadioButton Is Selected 839 Selecting a RadioButton in Code 839 Responding to RadioButton Clicks 844 13.3 CheckBox Controls 848 Determining in Code Whether a CheckBox Is Selected 848 Selecting a CheckBox in Code 849 Responding to CheckBox Clicks 853 13.4 ListView Controls 853 Retrieving the Selected Item 855 Retrieving the Index of the Selected Item 856 Responding to Item Selection with an Event Handler 859 Adding Items versus Setting Items 860 Initializing a ListView with an Array or an ArrayList 861 Selection Modes 862 Retrieving Multiple Selected Items 863                      
  • 34. Working With the Elements of an ObservableList 866 Converting an ObservableList to an Array 867 Using Code to Select an Item in a ListView 868 ListView Orientation 868 Creating ListViews of Objects Other Than String 869 13.5 ComboBox Controls 874 Retrieving the Selected Item 875 Responding to ComboBox Item Selection with an Event Handler 877 Editable ComboBoxes 879 13.6 Slider Controls 880 13.7 TextArea Controls 885 13.8 Menus 887 Assigning Mnemonics to Menu Items 895 13.9 The FileChooser Class 897 Displaying a FileChooser Dialog Box 898 13.10 Using Console Output to Debug a GUI Application 898 13.11 Common Errors to Avoid 902 Review Questions 902 Programming Challenges 906 Chapter 14 JavaFX: Graphics, Effects, and Media 909 14.1 Drawing Shapes 909 The Screen Coordinate System 909 The Shape Class and Its Subclasses 910                       
  • 35. The Line Class 911 Changing the Stroke Color 914 The Circle Class 914 The Rectangle Class 918 The Ellipse Class 921 The Arc Class 924 The Polygon Class 928 The Polyline Class 931 The Text Class 933 Rotating Nodes 936 Scaling Nodes 938 14.2 Animation 940 The TranslateTransition Class 941 The RotateTransition Class 944 The ScaleTransition Class 949 The StrokeTransition Class 952 The FillTransition Class 953 The FadeTransition Class 954 Controlling the Animation 956 Specifying an Interpolator 956 14.3 Effects 958 The DropShadow Class 958                      
  • 36. The InnerShadow Class 961 The ColorAdjust Class 962 The BoxBlur , GaussianBlur , and MotionBlur Classes 962 The SepiaTone Class 965 The Glow Class 966 The Reflection Class 967 Combining Effects 967 14.4 Playing Sound Files 969 Registering an EndOfMedia Event Handler 971 14.5 Playing Videos 974 14.6 Handling Key Events 979 Using an Anonymous Inner Class to Register a Key Event Handler to the Scene 980 Using a Lambda Expression to Register a Key Event Handler to the Scene 981 14.7 Handling Mouse Events 986 14.8 Common Errors to Avoid 992 Review Questions 992 Programming Challenges 995 Chapter 15 Recursion 999 15.1 Introduction to Recursion 999 15.2 Solving Problems with Recursion 1002 Direct and Indirect Recursion 1006 15.3 Examples of Recursive Methods 1007                      
  • 37. Summing a Range of Array Elements with Recursion 1007 Drawing Concentric Circles 1008 The Fibonacci Series 1011 Finding the Greatest Common Divisor 1012 15.4 A Recursive Binary Search Method 1014 15.5 The Towers of Hanoi 1017 15.6 Common Errors to Avoid 1021 Review Questions and Exercises 1022 Programming Challenges 1025 Chapter 16 Databases 1027 16.1 Introduction to Database Management Systems 1027 JDBC 1028 SQL 1029 Using a DBMS 1029 Java DB and Apache Derby 1030 Creating the CoffeeDB Database 1030 Connecting to the CoffeeDB Database 1030 Connecting to a Password-Protected Database 1032 16.2 Tables, Rows, and Columns 1033 Column Data Types 1035 Primary Keys 1035 16.3 Introduction to the SQL SELECT Statement 1036 Passing an SQL Statement to the DBMS 1038                       
  • 38. Specifying Search Criteria with the WHERE Clause 1048 Sorting the Results of a SELECT Query 1054 Mathematical Functions 1055 16.4 Inserting Rows 1058 Inserting Rows with JDBC 1060 16.5 Updating and Deleting Existing Rows 1062 Updating Rows with JDBC 1063 Deleting Rows with the DELETE Statement 1067 Deleting Rows with JDBC 1067 16.6 Creating and Deleting Tables 1071 Removing a Table with the DROP TABLE Statement 1074 16.7 Creating a New Database with JDBC 1074 16.8 Scrollable Result Sets 1076 16.9 Result Set Metadata 1077 16.10 Relational Data 1084 Joining Data from Multiple Tables 1086 An Order Entry System 1087 16.11 Advanced Topics 1100 Transactions 1100 Stored Procedures 1101 16.12 Common Errors to Avoid 1102 Review Questions and Exercises 1102 Programming Challenges 1107                       
  • 39. Index 1109 The following appendices, online chapters, and online case studies are available on the book’s online resource page at www.pearson.com/cs-resources. Online Appendices: Appendix A: The ASCII/Unicode Characters Appendix B: Operator Precedence and Associativity Appendix C: Java Key Words Appendix D: Installing the JDK and Using the JDK Documentation Appendix E: Using the javadoc Utility Appendix F: More about the Math Class Appendix G: Packages Appendix H: Working with Records and Random - Access Files Appendix I: Configuring Java DB and Installing Apache Derby Appendix J: The QuickSort Algorithm Appendix K: Named Colors Appendix L: Answers to Checkpoints Appendix M: Answers to Odd-Numbered Review Questions Online Chapters: Chapter 17: A First look at GUI Applications Chapter 18: Advanced GUI Applications Chapter 19: Applets and More Chapter 20: Creating GUI Applications with JavaFX and Scene Builder                  
  • 40. Online Case Studies: Case Study 1: Calculating Sales Commission Case Study 2: The Amortization Class Case Study 3: The PinTester Class Case Study 4: Parallel Arrays Case Study 5: The FeetInches Class Case Study 6: The SerialNumber Class Case Study 7: A Simple Text Editor Application       
  • 41. Location of videonotes in the text Chapter 1 Compiling and Running a Java Program, p. 14 Using an IDE, p. 14 Your First Java Program, p. 25 Chapter 2 Displaying Console Output, p. 33 Declaring Variables, p. 39 Simple Math Expressions, p. 55 The Miles-per-Gallon Problem, p. 107 Chapter 3 The if Statement, p. 111 The if-else Statement, p. 120 The if-else-if Statement, p. 129 The Time Calculator Problem, p. 182 Chapter 4 The while Loop, p. 193 The Pennies for Pay Problem, p. 263    
  • 42. Chapter 5 Passing Arguments to a Method, p. 279 Returning a Value from a Method, p. 293 The Retail Price Calculator Problem, p. 311 Chapter 6 Writing Classes and Creating Objects, p. 325 Initializing an Object with a Constructor, p. 346 The Personal Information Class Problem, p. 395 Chapter 7 Accessing Array Elements in a Loop, p. 407 Passing an Array to a Method, p. 422 The Charge Account Validation Problem, p. 487 Chapter 8 Returning Objects from Methods, p. 503 Aggregation, p. 515 The BankAccount , Class Copy Constructor Problem, p. 552    
  • 43. Chapter 9 The Sentence Capitalizer Problem, p. 605 Chapter 10 Inheritance, p. 611 Polymorphism, p. 655 The Employee and Productionworker Classes Problem, p. 696 Chapter 11 Handling Exceptions, p. 701 The Exception Project Problem, p. 757 Chapter 12 Introduction to JavaFX, p. 762 Creating Scenes, p. 765 Displaying Images, p. 772 The HBox Layout Container, p. 777 The VBox Layout Container, p. 782 The GridPane Layout Container, p. 784 Button Controls and Events, p. 792    
  • 44. The TextField Control, p. 799 Using Anonymous Inner Classes as Event Handlers, p. 803 Using Lambda Expressions as Event Handlers, p. 806 The Latin Translator Problem, p. 818 Chapter 13 JavaFX and CSS, p. 823 RadioButton Controls, p. 838 CheckBox Controls, p. 848 ListView Controls, p. 853 ComboBox Controls, p. 874 Slider Controls, p. 880 The Dorm and Meal Plan Calculator Problem, p. 906 Chapter 14 Drawing Shapes with JavaFX, p. 909 JavaFX Animation, p. 940 JavaFX Effects, p. 958  
  • 45. Playing Sound Files with JavaFX, p. 970 Playing Videos with JavaFX, p. 974 Handling Key Events in JavaFX, p. 979 Handling Mouse Events in JavaFX, p. 986 The Coin Toss Problem, p. 996 Chapter 15 Reducing a Problem with Recursion, p. 1003 The Recursive Power Problem, p. 1026 Chapter 16 The Customer Inserter Problem, p. 1107  
  • 46. Preface Welcome to Starting Out with Java: From Control Structures through Objects, Seventh Edition. This book is intended for a one-semester or a two- quarter CS1 course. Although it is written for students with no prior programming background, even experienced students will benefit from its depth of detail. Control Structures First, Then Objects This text first introduces the student to the fundamentals of data types, input and output, control structures, methods, and objects created from standard library classes. Next, the student learns to use arrays of primitive types and reference types. After this, the student progresses through more advanced topics, such as inheritance, polymorphism, the creation and management of packages, GUI applications, recursion, and database programming. From early in the book, applications are documented with javadoc comments. As the student progresses through the text, new javadoc tags are covered and demonstrated. As with all the books in the Starting Out With … series, the hallmark of this text is its clear, friendly, and easy-to-understand writing. In addition, it is rich in example programs that are concise and practical.
  • 47. Changes in the Seventh Edition This book’s pedagogy, organization, and clear writing style remain the same as in the previous edition. The most significant change in this edition is the switch from Swing to JavaFX in the chapters that focus on GUI development. Although Swing is not officially deprecated, Oracle has announced that JavaFX has replaced Swing as the standard GUI library for Java. http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6 In this edition, we have added the following new chapters: CHAPTER 12 JAVAFX: GUI PROGRAMMING AND BASIC CONTROLS This chapter presents the basics of developing graphical user interface (GUI) applications with JavaFX. Fundamental controls, layout containers, and the basic concepts of event-driven programming are covered. CHAPTER 13 JAVAFX: ADVANCED CONTROLS This chapter discusses CSS styling and advanced user interface controls. CHAPTER 14 JAVAFX: GRAPHICS, EFFECTS, AND MEDIA This chapter discusses 2D shapes, animation, visual effects, playing audio and video, and responding to mouse and keyboard events. The Swing and Applet material that appeared in the previous edition is still available on the book’s companion Web site, as the following online chapters: The previous Chapter 12 A First Look At GUI Applications is now available online as Chapter 17 . The previous Chapter 13 Advanced GUI Applications is now available online as Chapter 18 . 1 1       
  • 48. The previous Chapter 14 Applets and More is now available online as Chapter 19 . Note: Chapter 15 from the previous edition has also been moved to the book’s companion Web site as Chapter 20 Creating JavaFX Applications with Scene Builder. Although Oracle no longer officially supports Scene Builder, it is still available as an open source tool at http://http://gluonhq.com/labs/scene-builder/ In addition to the new JavaFX chapters, the Database chapter, which is now Chapter 15 , has been updated to use JavaFX instead of Swing for its GUI applications. We have also added several new, motivational programming problems throughout the book. Organization of the Text The text teaches Java step-by-step. Each chapter covers a major set of topics and builds knowledge as students progress through the book. Although the chapters can be easily taught in their existing sequence, there is some flexibility. Figure P-1 shows chapter dependencies. Each box represents a chapter or a group of chapters. An arrow points from a chapter to the chapter that must be previously covered.      
  • 49. Figure P-1 Chapter dependencies
  • 50. Another Random Scribd Document with Unrelated Content
  • 51. N. C. C. W.; A. B. U. N. C., 1920. Mathematics teacher in Wilson High School, 1920-21; Salisbury High School, 1921-22. Gattis, Alice Lee Chapel Hill, N. C. A. B. U. N. C., 1922. Gattis, Lillian Foushee Chapel Hill, N. C. U. N. C., 1919— Ghent, Marguerite Dothan, Ala. U. N. C., 1921— Goforth, Caroline L. 318 McClintock Bldg., Denver, Colo. Graduate N. C. C. W.; U. N. C., 1918-19; Columbia University and National Training School of the Y. W. C. A., 1919-20. Taught in Jamestown High School, 1917-18; student secretary, Y. W. C. A., for colleges and universities in Utah, Kansas, Wyoming, and Colorado. Goforth, Willard
  • 52. (Mrs. E. Eybers) Stellenbasch Univ., Stellenbasch, South Africa N. C. C. W., 1916-18; U. N. C., 1918-19; Barnard College, 1919- 20. Married July, 1920. Graves, Mary DeBerniere (Mrs. A. D. Rees) 308 Locust St., Philadelphia, Pa. St. Mary’s School; Stuart Hall; U. N. C., 1905-06; Maryland Institute; Academy of Fine Arts, Philadelphia. Advertising and illustrating work for New York World and Judge; illustrated articles in Saturday Magazine of New York Evening Post and Sunday Tribune. Married Sept. 18, 1919; has one son, Arthur Pembroke. Greenlaw, Dorothy Durland Chapel Hill, N. C. U. N. C., 1918— Grimes, Alice Dugger (Mrs. Walter H.) Raleigh, N. C. Graduate St. Mary’s School; U. N. C., 1907-08. Has one son.
  • 53. Ham, Mattie (Mrs. J. A. McRae) 303 Monroe Road, Charlotte, N. C. Law student U. N. C., 1914-15. Fourth woman lawyer to pass Supreme Court examination. Practiced law several months. Was married Jan. 22, 1916; has three children, two sons and one daughter. Member D. A. R. Hamilton, Martha Metzger (Mrs. T. H.) Chapel Hill, N. C. U. N. C., 1921— Hand, Erwin Robinson (Mrs. J. K.) Charlotte, N. C. U. N. C., 1905-06. Hankins, Melissa M. 4722 Springfield Ave., Philadelphia, Pa. A. B. Salem College; U. N. C., 1920-21; now studying medicine at University of Pennsylvania.
  • 54. Harmon, Minnie Etta Tazewell, Va. A. B. Lynchburg College; U. N. C., 1921— Harper, Alice Hermina Address unknown. Boston Univ.; U. N. C., 1906-07. Harris, Julia Hamlet Meredith College, Raleigh, N. C. Graduate St. Mary’s School; Ph. B. U. N. C., 1905; A. M. Cornell University; Ph. D. Yale University. In Department of English, Meredith College. Henderson, Curtis Chapel Hill, N. C. U. N. C., 1921— Henderson, Mary Ferrand Salisbury, N. C. Graduate St. Mary’s School; law student U. N. C., 1915-16.
  • 55. Hill, Annie Belle Howard Jackson, Tenn. B. L. Flora MacDonald; A. B. U. N. C., 1922. Holland, Alma Chapel Hill, N. C. U. N. C., 1919-20. Assistant, Department of Botany, U. N. C. Horsfield, Margaret Bennitt 218 E. Maxwell St., Lexington, Ky. A. B. U. N. C., 1911; studied in Paris summer of 1913; Columbia University, summer sessions 1917, 1918, 1921. Member faculty Salem College, 1911-17; now instructor romance languages, University of Kentucky. Hooper, Caroline Alice Hendersonville, N. C. U. N. C., 1900-01. Teacher of French in Fassifern School. Huffman, Willie Costner (Mrs. E. W. G.) Chapel Hill, N. C.
  • 56. Lenoir College; N. C. C. W.; U. N. C., 1921— Hughes, Adeline Edmonds Henderson, N. C. Graduate St. Mary’s School; A. B. U. N. C., 1921. Secretary to the director, School of Public Welfare, U. N. C. Hume, Mary Gregory (Mrs. J. E. Mills) Edgewood Arsenal, Edgewood, Md. Hollins Institute; U. N. C., 1905-06. Taught in Birmingham, Ala.; Asheville, N. C.; and Richmond, Va. Married October 15, 1921. Author of a number of short stories in various magazines. Jarman, Mary (Mrs. T. A. Hearn) 18 Quinsan Road, Shanghai, China A. B. U. N. C., 1911; graduate St. Luke’s Hospital, Jacksonville. Established training school for nurses, Huchow, China. Married December, 1918; has two sons. Editorial secretary, Nurses Assoc, of China; editor bilingual Quarterly Journal for Chinese Nurses. Johnson, Annie Susan
  • 57. (Mrs. W. R. Barber) 25 Boulevard, Whitestone, L. I., New York U. N. C., 1904-06. Johnston, Addie Louise Mebane, N. C. N. C. C. W.; U. N. C., 1919-20. Jones, Alice Edwards Chapel Hill, N. C. Ph. B. U. N. C., 1900, A. M., 1904; Columbia University (summer session); student in archaeology American Academy, Rome, Italy, 1913-14. Taught Latin in St. Mary’s School and Winthrop College; lady principal, St. Mary’s; associate principal, Catlin School, Portland, Oreg.; dean, St. Mary’s College, Dallas, Tex. Jones, Leah Donnell (Mrs. L. J. Stevens) New Berne, N. C. U. N. C., 1899-1900. Married, 1907; has one son, John Duval. Superintendent Public Welfare, Craven County. Jones, Margaret Mordecai
  • 58. (Mrs. Ernest Cruikshank) Columbia, Tenn. St. Mary’s School; U. N. C., 1900-01; B. S. and Teachers’ Diploma, Teachers College, Columbia University, 1911; studied in Europe, 1907 and 1911. Taught mathematics in St. Mary’s School and N. Y. City High School. Married June 7, 1911; has three children, one son and two daughters. Jones, Mary Best (Mrs. Isaac H. Manning) Chapel Hill, N. C. Graduate N. C. C. W.; U. N. C., 1910-11. Teacher in public schools of Goldsboro, Wilmington, and Chapel Hill. Married June 6 1911; has three sons. Author of Songs of the Seasons and a number of short stories published in children’s papers. Member of D. A. R. and Colonial Dames. Joyner, Ruth Deans (Mrs.) 308 Park Ave., Wilson, N. C. A. B. N. C. C. W.; U. N. C., 1920-21. Justice, Margaret Curtis Chapel Hill, N. C.
  • 59. Columbia University; U. N. C., 1921. Kasey, Watson (Mrs. Theodore H. Partrick) Plymouth, N. C. Stuart Hall; A. B. U. N. C., 1913. Taught in Salem College. Kendrick, Mary Pearson 83 Elm St., Jamaica Plain, Boston, Mass. A. B. Smith College; A. M. U. N. C., 1899. Kennette, Ernestine Chapel Hill, N. C. Graduate N. C. C. W.; A. B. U. N. C., 1918. Doing secretarial work, School of Education, U. N. C. Lambertson, Brownie Augusta (Mrs. ....................) Address unknown. U. N. C., 1903-06. Latham, Marcia Louise
  • 60. 432 Central Park West, New York City Ph. B. U. N. C., 1900. Latshaw, Sylvia Louise (Mrs. Harry F.) Chapel Hill, N. C. A. B. Flora Macdonald; A. B. in Educ. U. N. C., 1920, A. M. 1921. Teacher in Chapel Hill High School. Lawton, Beulah Scotte 89 Lawton St., Atlanta, Ga. U. N. C., 1920-21. Playground director in Macon, Ga.; Y. W. C. A. secretary in Parlin, N. J., and Greenville, S. C.; executive secretary, American Red Cross, Gibson County, Tenn. Lay, Elizabeth Atkinson Chapel Hill, N. C. Graduate St. Mary’s School; A. B. U. N. C., 1919, A. M., 1922. Field agent, Bureau of Community Drama, University Extension Division. Author of When Witches Ride, The Hag, Trista, and several bulletins; joint author of Blackbeard: Pirate of the Carolina Coast. One of the first and foremost workers in the Carolina Playmakers. Her engagement to Paul E. Greene, ’21, has just been announced.
  • 61. Lay, Ellen Booth Beaufort, N. C. Graduate St. Mary’s School; A. B. U. N. C., 1922. Joint author of In Dixon’s Kitchen, produced by the Carolina Playmakers. Levis, Anna Conron Govans, Md. U. N. C., 1921— Lewis, Callie Agnes (Mrs. P. A. Reynolds) 132 Dunleith Ave., Winston-Salem, N. C. A. B. U. N. C., 1917. Taught in Chapel Hill High School, 1917-18. Married August 28, 1918. Has two daughters. Liddell, Anna Forbes 600 East Ave., Charlotte, N. C. A. B. U. N. C., 1918. With McGraw-Hill Pub. Co., New York, 1918-19; since then teacher of English in Salisbury High School. Long, Ruth Virginia Chapel Hill, N. C. U. N. C., 1920-21.
  • 62. Lynch, Margaret (Mrs. C. L. Murphy) Salisbury, N. C. School of Pharmacy, U. N. C., 1916-17. Lynch, Rachel (Mrs. Eugene Simpson) 810 Cloverdale Ave., Winston-Salem, N. C. B. Ped. N. C. C. W.; A. B. U. N. C., 1915. Taught in western N. C. Married June 17, 1919. Has one daughter, Margaret Lynch. MacDonald, Caroline Goldsboro, N. C. U. N. C., 1899-1900. MacKenzie, Frances Elizabeth Raleigh, N. C. Law student U. N. C., 1918-20. After obtaining license practiced a year in New Berne with Moore and Dunn; at present has her own office in the Allen Building. MacMillan, Genevieve
  • 63. Red Springs, N. C. A. B. Flora MacDonald; A. B. U. N. C., 1922. MacRae, Mary Shackelford (Mrs. R. L. Gray) Durham, N. C. U. N. C., 1897-98—the first woman to register in the University. Has two sons and one daughter. Her eldest son has been in the University for three years and her daughter is ready to enter the freshman class. McCarthy, Eleanor B. 2405 Grove Ave., Richmond, Va. U. N. C., 1919-20. Laboratory technician Watts Hospital, Durham, for one year. McFadyen, Virginia Hendon (Mrs. Edwin Bjorkman) 226 Fifth Ave., New York City A. B. U. N. C., 1919. Taught school one year. Married, 1921. Retains maiden name. McGlamery, Winnie
  • 64. Winthrop College, Rock Hill, S. C. U. N. C., 1915-18; A. B. Goucher College, 1919. Secretary to the president of Haverford College, 1919-20; taught at Mary Baldwin Seminary, 1920-21; extension secretary, Winthrop College, 1921-22. McIver, Lula Martin Spring Garden St., Greensboro, N. C. Graduate N. C. C. W.; U. N. C., 1921-22. McKie, Elizabeth Frances Chapel Hill, N. C. U. N. C., 1920— McQueen, Anna Address unknown. U. N. C., 1902-03. Missionary in Korea. Macon, Mary Litchford 2247 W. Thompson St., Philadelphia, Pa. U. N. C., 1917-18, 1920 (spring term); student Woman’s Medical College of Pennsylvania, taking the course for laboratory technicians.
  • 65. Matthews, Helen Ingram Charlotte, N. C. Erskine College; law student U. N. C., 1916-17. Meares, Katherine DeRosset Drawer B. Ridgeway, S. C. Graduate St. Mary’s School; A. B. U. N. C., 1920; Columbia University. Taught in high schools of Bennettsville and Anderson, S. C., and Goldsboro, N. C.; head of Department of Latin, Columbia College, Columbia, S. C. Merritt, Bessie Lee Chapel Hill, N. C. Pharmacy student U. N. C., 1918-19. Secretary to chief, Bureau of High School Debating and Athletics, University Extension Division. Merritt, Lena Evelyn Burlington, N. C. U. N. C., 1918-19. Miller, Marion Spiers Treasury Department, Washington, D. C. A. B. U. N. C., 1918. In office of Register of the Treasury.
  • 66. Miller, Mary Scales War Department, Washington, D. C. Queens College; A. B. U. N. C., 1916. In office of Adjutant General. Moore, Magnolia Arcena (Mrs. J. S.) Fremont, N. C. U. N. C., 1919-20. Has three children. Morris, Myrtle Estelle Lubbock, Texas A. M. U. N. C., 1918. Teaches in public schools during the school year and spends summers on ranch. Moses, Mildred (Mrs. Louis Graves) Chapel Hill, N. C. N. C. C. W.; U. N. C., 1917-18. Taught in city schools in Wilson, Morganton, Durham, and Chapel Hill; secretary to the librarian, U. N. C., 1919. Married June 18, 1921.
  • 67. Moss, Cora Jenkins Franklinton, N. C. A. B. Trinity College; U. N. C., 1921— Moxley, Jane Elizabeth 90 High St., Nutley, N. J. U. N. C., 1922. Neal, Naomi Mullins, S. C. A. B. N. C. C. W.; U. N. C., 1921. Neville, Grace Virginia Chapel Hill, N. C. Elon College; U. N. C., 1921— Noa, Ernestine Lookout Mountain, Tenn. Completed special courses in Goucher College, Cleveland Kindergarten College, Peabody College; U. N. C., 1914-15. Assistant to Dr. E. C. Branson, U. N. C., 1915-20; at present president Tenn. Woman’s Press and Author’s Club, and holding office in a number of other local or state clubs.
  • 68. Norburn, Martha Elizabeth R. F. D. Box 4, Candler, N. C. U. N. C., 1919-20. Odom, Helen Louise 1519 Park Ave., Baltimore, Md. U. N. C., 1900-02. After doing some tutoring took up secretarial work; with War Department, 1918-21; now chief clerk Md. State Board of Motion Picture Censors. Odum, Ana Kranz (Mrs. H. W.) Chapel Hill, N. C. A. M. Clarke University; U. N. C., 1921— Palmer, Madeline Elizabeth (Mrs. Edmund McRary) Charlotte, N. C. LL. B. U. N. C., 1919. Parker, Julia Piccola
  • 69. New Berne, N. C. Trinity College; U. N. C., 1921— Pasmore, Julia C. Cary, N. C. Graduate N. C. C. W.; A. B. U. N. C., 1918. Patterson, Harriet Oldring (Mrs. F. E. Bel) 162 Beacon St., Hartford, Conn. U. N. C., 1913-14. Peele, Rennie Clarksville, Va. A. B. U. N. C., 1915; Columbia University (summer session), 1919; Harvard University (summer session), 1921. Taught in Burgaw, N. C., 1911-13; in Florida, 1913-18; now teaching English in Goldsboro High School. President State Council of English Teachers, 1921. Pelton, Mabell Shippie Clarke (Mrs. J. Ravenel Smith) 39 East 10th St., New York City
  • 70. A. B. Boston University; A. M. U. N. C., 1905. Married October, 1907. Author of A Tar Heel Baron, The Spirit of French Letters, Twenty Centuries of Paris, Ethel Morton Books. Member D. A. R., Soc. Mayflower Descendants, Colonial Dames, Phi Beta Kappa. Pendergraft, Pearl Chapel Hill, N. C. U. N. C., 1919— Penn, May Belle 819 N. Elm St., Greensboro, N. C. N. C. C. W.; U. N. C., 1921— Penny, Ruth (Mrs. H. C. Heffner) Maiden, N. C. A. B. U. N. C., 1921. Taught in Cornelius High School Sept., Dec., 1921. Married April 8, 1922. Perry, Margaret Gray Wilkesboro, N. C. Graduate N. C. C. W.; A. M. U. N. C., 1920. Teacher.
  • 71. Pickard, Nell A. P. Chapel Hill, N. C. A. B. U. N. C., 1921. Teacher in Durham High School. Pickard, Minna Thelma Elizabeth City, N. C. A. B. U. N. C., 1917. Taught in Lexington High School 1917- 1918; since then teacher of science Elizabeth City High School. Pollock, M. Keatinge Chapel Hill, N. C. U. N. C., 1921— Price, Mildred Chapel Hill, N. C. N. C. C. W.; A. B. U. N. C., 1922. Pritchard, Birdie (Mrs. R. O. E. Davis) 1425 Crittenden St., N. W., Washington, D. C. Ph. B. U. N. C., 1902. Married 1905. Two years in associated charity work in Washington; now detail clerk, Veterans’ Bureau.
  • 72. Pritchard, Maude (Mrs. A. B. Bristow) Palisade Apt., W. Ghent Blvd., Norfolk, Va. A. B. Elon College; A. M. U. N. C., Taught in Waverley, Va.; City Point. Married August 16, 1916. Principal Carson High School. Pritchard, Vera Chapel Hill, N. C. Elon College; A. B. U. N. C., 1920. Taught in Cherryville schools, 1921-22. Pruden, Lina Tucker Edenton, N. C. N. C. C. W.; A. B. U. N. C., 1922. Pruitt, Annie R. F. D. No. 1, Stem, N. C. A. B. U. N. C., 1921. Puett, Anna Mariah 317 Tarboro St., Rocky Mount, N. C.
  • 73. A. B. Chicora College; A. B. U. N. C., 1914. Has taught ever since leaving University, spending the summers usually in some summer school or in traveling; is at present teaching mathematics in the Rocky Mount High School. Rankin, Kathleen Adair (Mrs. Will Moore) Gastonia, N. C. U. N. C., 1900-01. Reid, Louisa Pressly 307 S. Broad Street, Gastonia, N. C. A. B. Queens College, 1917; A. B. U. N. C., 1918, and A. M., 1921. Taught romance languages in Peace Institute, 1919-1920; Chapel Hill High School, 1920-21; Gastonia, 1921-22. Richardson, Helen St. Martinville, La. U. N. C., 1920-21. In government service during the war; secretary, St. Martinville Chapter American Red Cross. Roberson, Mary (Mrs. Roy Mason) 139 E. 66th St., New York City
  • 74. U. N. C., 1916-17. Nurse’s Training course U. P. I., Baltimore. Married April 6, 1918. Roberson, Nellie Chapel Hill, N. C. Woman’s College, Richmond, Va.; A. B. U. N. C., 1921. Chief of the Bureau of Public Discussion, University Extension Division. Robinson, Kathrine Mcdiarmid Fayetteville, N. C. N. C. C. W.; Washington College of Law; LL. B. U. N. C., 1920. In government service 1918-19; now attorney at law in partnership with her father. Rodman, Pearl Waxhaw, N. C. U. N. C., 1900-01. Rosemond, Thelma Marie Hillsboro, N. C. U. N. C., 1922. Russell, Dorothy Chapel Hill, N. C.
  • 75. U. N. C., 1921— Savley, Eva Davis (Mrs.) Clearwater Lighting Co., Clearwater, Fla. U. N. C., 1920-21. Scales, Elizabeth Walker (Mrs. V. S. Bryant, Jr.) Durham, N. C. A. B. Converse College; U. N. C., 1917-18. Married February, 1921. Scott, Rosa Naomi U. N. C., 1908-09. Sherrill, Mildred Irene Newton, N. C. A. B. Catawba College; A. B. U. N. C., 1920. Taught science in Henderson High School, 1920-21; teacher in Catawba College Academy.
  • 76. Shine, Claudia (Mrs. Lee J.) Chapel Hill, N. C. U. N. C., 1919-20. Has a son and a daughter, both alumni of the University. Shine, Lou Chapel Hill, N. C. A. B. U. N. C., 1921. Teacher in Elizabeth City schools. Sloan, Isabel Address unknown. Davidson College; A. B. U. N. C., 1917. Smith, Annie T. Durham, N. C. B. S. in medicine, U. N. C., 1920. Smith, Mattie Elizabeth Marshville, N. C. Pharmacy student U. N. C., 1921—
  • 77. Snyder, Ethel (Mrs. W. O. Seymour) Monroe, N. C. Chowan College, 1915-18; U. N. C., 1918-19. Married Sept. 29, 1919. Sparrow, Minnie Shepherd (Mrs. C. W. Keyes) 404 W. 115th St., New York City A. M. U. N. C., 1919. Married September, 1920. Spruill, Mary James Littleton, N. C. Graduate St. Mary’s School; Barnard College; A. B. U. N. C., 1921; A. M., 1922. Stacy, Mary Martha (Mrs. Will Dozier) Huntsboro, Ala. U. N. C., 1911-12. Staley, Bessie