did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780133776744

Starting Out with Java Early Objects

by
  • ISBN13:

    9780133776744

  • ISBN10:

    0133776743

  • Edition: 5th
  • Format: Paperback
  • Copyright: 2014-02-25
  • Publisher: Pearson
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $158.00

Summary


Note: You are purchasing a standalone product; MyProgrammingLab does not come packaged with this content. If you would like to purchase both the physical text and MyProgrammingLab  search for ISBN-10: 0133796302/ISBN-13: 9780133796308. That package includes ISBN-10: 0133776743/ISBN-13: 9780133776744 and ISBN-10:0133831779 /ISBN-13: 9780133831771.


MyProgrammingLab is not a self-paced technology and should only be purchased when required by an instructor.

 

Starting Out with Java: Early Objects is intended for use in the Java programming course. It is also suitable for all readers interested in an introduction to the Java programming language.  

 

Tony Gaddis’s accessible, step-by-step presentation helps beginning students understand the important details necessary to become skilled programmers at an introductory level. Gaddis motivates the study of both programming skills and the Java programming language by presenting all the details needed to understand the “how” and the “why”—but never losing sight of the fact that most beginners struggle with this material. His approach is both gradual and highly accessible, ensuring that students understand the logic behind developing high-quality programs.

In Starting Out with Java: Early Objects , Gaddis looks at objects—the fundamentals of classes and methods—before covering procedural programming. As with all Gaddis texts, clear and easy-to-read code listings, concise and practical real-world examples, and an abundance of exercises appear in every chapter.

 

MyProgrammingLab for Starting Out with Java: Early Objects is a total learning package. MyProgrammingLab is an online homework, tutorial, and assessment program that truly engages students in learning. It helps students better prepare for class, quizzes, and exams–resulting in better performance in the course–and provides educators a dynamic set of tools for gauging individual and class progress.

 

Teaching and Learning Experience

This program presents a better teaching and learning experience—for you and your students.

  • Personalize Learning with MyProgrammingLab: Through the power of practice and immediate personalized feedback, MyProgrammingLab helps students fully grasp the logic, semantics, and syntax of programming.
  • Enhance Learning with the Gaddis Approach: Gaddis’s accessible approach features clear and easy-to-read code listings, concise real-world examples, and exercises in every chapter.
  • Keep Your Course Current: Content is refreshed to provide the most up-to-date information on new technologies for your course.
  • Support Instructors and Students: Student and instructor resources are available to expand on the topics presented in the text. 

Author Biography

Tony Gaddis is the principal author of the Starting Out With series of textbooks. Tony has nearly two decades of experience teaching computer science courses, primarily at Haywood Community College. He is a highly acclaimed instructor who was previously selected as the North Carolina Community College “Teacher of the Year” and has received the Teaching Excellence award from the National Institute for Staff and Organizational Development. The Starting Out With series includes introductory books covering C++, Java™, Microsoft® Visual Basic®, Microsoft® C#®, Python®, Programming Logic and Design, Alice, and App Inventor, all published by Pearson. More information about all these books can be found at www.pearsonhighered.com/gaddisbooks.

Table of Contents

Preface xv

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

1.4 Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.5 What Is a Program Made of? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

1.6 The Programming Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

1.7 Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Review Questions and Exercises 24

Programming Challenge 28

 

Chapter 2 Java Fundamentals 31

2.1 The Parts of a Java Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

2.2 The System.out.print and System.out.println Methods, and the

Java API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

2.3 Variables and Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

2.4 Primitive Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

2.5 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

2.6 Combined Assignment Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

2.7 Conversion between Primitive Data Types . . . . . . . . . . . . . . . . . . . . . . 70

2.8 Creating Named Constants with final . . . . . . . . . . . . . . . . . . . . . . . . 74

2.9 The String Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

2.10 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

2.11 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

2.12 Programming Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

2.13 Reading Keyboard Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

2.14 Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

2.15 The System.out.printf Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

2.16 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Review Questions and Exercises 118

Programming Challenges 123

 

Chapter 3 A First Look at Classes and Objects 129

3.1 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

3.2 More about Passing Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

3.3 Instance Fields and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

3.4 Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

3.5 A BankAccount Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

3.6 Classes, Variables, and Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

3.7 Packages and import Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

3.8 Focus on Object-Oriented Design: Finding the Classes

and Their Responsibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

3.9 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

Review Questions and Exercises 183

Programming Challenges 187

 

Chapter 4 Decision Structures 193

4.1 The if Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

4.2 The if-else Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

4.3 The Payroll Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

4.4 Nested if Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

4.5 The if-else-if Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

4.6 Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222

4.7 Comparing String Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

4.8 More about Variable Declaration and Scope . . . . . . . . . . . . . . . . . . . 235

4.9 The Conditional Operator (Optional) . . . . . . . . . . . . . . . . . . . . . . . . . 237

4.10 The switch Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238

4.11 Formatting Numbers with the DecimalFormat Class . . . . . . . . . . . . . . 248

4.12 Focus on Problem Solving: The SalesCommission Class . . . . . . . . . . . . 254

4.13 Generating Random Numbers with the Random Class . . . . . . . . . . . . . 261

4.14 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

Review Questions and Exercises 268

Programming Challenges 273

 

Chapter 5 Loops and Files 279

5.1 The Increment and Decrement Operators . . . . . . . . . . . . . . . . . . . . . 279

5.2 The while Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

5.3 Using the while Loop for Input Validation . . . . . . . . . . . . . . . . . . . . . 290

5.4 The do-while Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

5.5 The for Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

5.6 Running Totals and Sentinel Values . . . . . . . . . . . . . . . . . . . . . . . . . . 307

5.7 Nested Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312

5.8 The break and continue Statements . . . . . . . . . . . . . . . . . . . . . . . . . . 320

5.9 Deciding Which Loop to Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

5.10 Introduction to File Input and Output . . . . . . . . . . . . . . . . . . . . . . . . 321

5.11 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341

Review Questions and Exercises 342

Programming Challenges 348

 

Chapter 6 A Second Look at Classes and Objects 357

6.1 Static Class Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357

6.2 Overloaded Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364

6.3 Overloaded Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

6.4 Passing Objects as Arguments to Methods . . . . . . . . . . . . . . . . . . . . . 376

6.5 Returning Objects from Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389

6.6 The toString Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392

6.7 Writing an equals Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396

6.8 Methods That Copy Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398

6.9 Aggregation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401

6.10 The this Reference Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

6.11 Inner Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417

6.12 Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420

6.13 Garbage Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429

6.14 Focus on Object-Oriented Design: Class Collaboration . . . . . . . . . . . 431

6.15 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435

Review Questions and Exercises 436

Programming Challenges 441

 

Chapter 7 Arrays and the ArrayList Class 449

7.1 Introduction to Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449

7.2 Processing Array Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460

7.3 Passing Arrays as Arguments to Methods . . . . . . . . . . . . . . . . . . . . . . 472

7.4 Some Useful Array Algorithms and Operations . . . . . . . . . . . . . . . . . . 476

7.5 Returning Arrays from Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488

7.6 String Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490

7.7 Arrays of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494

7.8 The Sequential Search Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498

7.9 The Selection Sort and the Binary Search Algorithms . . . . . . . . . . . . . 501

7.10 Two-Dimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509

7.11 Arrays with Three or More Dimensions . . . . . . . . . . . . . . . . . . . . . . . 521

7.12 Command-Line Arguments and Variable-Length Argument Lists . . . . 522

7.13 The ArrayList Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526

7.14 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534

Review Questions and Exercises 535

Programming Challenges 539

 

Chapter 8 Text Processing and Wrapper Classes 547

8.1 Introduction to Wrapper Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547

8.2 Character Testing and Conversion with the Character Class . . . . . . . 548

8.3 More about String Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555

8.4 The StringBuilder Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569

8.5 Tokenizing Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578

8.6 Wrapper Classes for the Numeric Data Types . . . . . . . . . . . . . . . . . . . 587

8.7 Focus on Problem Solving: The TestScoreReader Class . . . . . . . . . . . . 591

8.8 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595

Review Questions and Exercises 595

Programming Challenges 599

 

Chapter 9 Inheritance 605

9.1 What Is Inheritance? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605

9.2 Calling the Superclass Constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . 616

9.3 Overriding Superclass Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624

9.4 Protected Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632

9.5 Classes That Inherit from Subclasses . . . . . . . . . . . . . . . . . . . . . . . . . . 639

9.6 The Object Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644

9.7 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646

9.8 Abstract Classes and Abstract Methods . . . . . . . . . . . . . . . . . . . . . . . 651

9.9 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657

9.10 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668

Review Questions and Exercises 669

Programming Challenges 675

 

Chapter 10 Exceptions and Advanced File I/O 681

10.1 Handling Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681

10.2 Throwing Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704

10.3 Advanced Topics: Binary Files, Random Access Files, and Object

Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712

10.4 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728

Review Questions and Exercises 729

Programming Challenges 735

 

Chapter 11 GUI Applications–Part 1 739

11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739

11.2 Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742

11.3 Creating Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753

11.4 Layout Managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780

11.5 Radio Buttons and Check Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797

11.6 Borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810

11.7 Focus on Problem Solving: Extending the JPanel Class . . . . . . . . . . . 812

11.8 Splash Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826

11.9 Using Console Output to Debug a GUI Application . . . . . . . . . . . . . . 827

11.10 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831

Review Questions and Exercises 831

Programming Challenges 836

 

Chapter 12 GUI Applications–Part 2 841

12.1 Read-Only Text Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841

12.2 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842

12.3 Combo Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 859

12.4 Displaying Images in Labels and Buttons . . . . . . . . . . . . . . . . . . . . . . 865

12.5 Mnemonics and Tool Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871

12.6 File Choosers and Color Choosers . . . . . . . . . . . . . . . . . . . . . . . . . . . 873

12.7 Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877

12.8 More about Text Components: Text Areas and Fonts . . . . . . . . . . . . . 886

12.9 Sliders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 891

12.10 Look and Feel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895

12.11 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897

Review Questions and Exercises 898

Programming Challenges 903

 

Chapter 13 Applets and More 909

13.1 Introduction to Applets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 909

 

 

13.2 A Brief Introduction to HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 911

13.3 Creating Applets with Swing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921

13.4 Using AWT for Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929

13.5 Drawing Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 934

13.6 Handling Mouse Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954

13.7 Timer Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965

13.8 Playing Audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969

13.9 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 974

Review Questions and Exercises 974

Programming Challenges 980

 

Chapter 14 Creating GUI Applications with JavaFX 983

14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983

14.2 Scene Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 985

14.3 Using Scene Builder to Create JavaFX Applications . . . . . . . . . . . . . . . 987

14.4 Writing the Application Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1001

14.5 RadioButtons and CheckBoxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1011

14.6 Displaying Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1025

14.7 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1030

Review Questions and Exercises 1030

Programming Challenges 1034

 

Chapter 15 Recursion 1039

15.1 Introduction to Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1039

15.2 Solving Problems with Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . 1042

15.3 Examples of Recursive Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046

15.4 A Recursive Binary Search Method . . . . . . . . . . . . . . . . . . . . . . . . . . 1053

15.5 The Towers of Hanoi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1056

15.6 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1060

Review Questions and Exercises 1061

Programming Challenges 1064

 

Chapter 16 Databases 1067

16.1 Introduction to Database Management Systems . . . . . . . . . . . . . . . 1067

16.2 Tables, Rows, and Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1073

16.3 Introduction to the SQL SELECT Statement . . . . . . . . . . . . . . . . . . . . 1077

16.4 Inserting Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1098

16.5 Updating and Deleting Existing Rows . . . . . . . . . . . . . . . . . . . . . . . 1101

16.6 Creating and Deleting Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1110

16.7 Creating a New Database with JDBC . . . . . . . . . . . . . . . . . . . . . . . . 1114

16.8 Scrollable Result Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1115

16.9 Result Set Meta Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1117

16.10 Displaying Query Results in a JTable . . . . . . . . . . . . . . . . . . . . . . . . 1120

16.11 Relational Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1131

16.12 Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1152

16.13 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1154

Review Questions and Exercises 1155

Programming Challenges 1160

Appendix A Getting Started with Alice 2 1163

Index 1189

Credits 1205

 

Available on the book’s online resource page at

www.pearsonhighered.com/gaddis

Appendix B The ASCII/Unicode Characters

Appendix C Operator Precedence and Associativity

Appendix D Java Key Words

Appendix E Installing the JDK and JDK Documentation

Appendix F Using the javadoc Utility

Appendix G More about the Math Class

Appendix H Packages

Appendix I Working with Records and Random-Access Files

Appendix J Installing Java DB

Appendix K The QuickSort Algorithm

Appendix L Answers to Checkpoints Questions

Appendix M Answers to Odd-Numbered Review Questions

Case Study 1 The Amortization Class

Case Study 2 The PinTester Class

Case Study 3 Parallel Arrays

Case Study 4 The SerialNumber Class

Case Study 5 A Simple Text Editor Application

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program