Skip to main content
E-Book

$84.00

Big Java: Early Objects, Interactive Edition, 6th Edition

Cay S. Horstmann

ISBN: 978-1-119-14159-4 December 2015 1040 Pages

Description

Cay Horstmann's sixth edition of Big Java, Early Objects provides an approachable introduction to fundamental programming techniques and design skills, helping students master basic concepts and become competent coders. Updates for the Java 8 software release and additional visual design elements make this student-friendly text even more engaging. The text is known for its realistic programming examples, great quantity and variety of homework assignments, and programming exercises that build student problem-solving abilities. This edition now includes problem solving sections, more example code online, and exercise from Science and Business.

Related Resources

PREFACE iii

SPECIAL FEATURES xxiv

1 INTRODUCTION 1

1.1 Computer Programs 2

1.2 The Anatomy of a Computer 3

1.3 The Java Programming Language 6

1.4 Becoming Familiar with Your Programming Environment 7

1.5 Analyzing Your First Program 11

1.6 Errors 14

1.7 PROBLEM SOLVING Algorithm Design 15

2 USING OBJECTS 31

2.1 Objects and Classes 32

2.2 Variables 34

2.3 Calling Methods 41

2.4 Constructing Objects 46

2.5 Accessor and Mutator Methods 48

2.6 The API Documentation 50

2.7 Implementing a Test Program 53

2.8 Object References 55

2.9 Graphical Applications 59

2.10 Ellipses, Lines, Text, and Color 64

3 IMPLEMENTING CLASSES 79

3.1 Instance Variables and Encapsulation 80

3.2 Specifying the Public Interface of a Class 84

3.3 Providing the Class Implementation 91

3.5 PROBLEM SOLVING Tracing Objects 103

3.6 Local Variables 105

3.7 The this Reference 107

4 FUNDAMENTAL DATA TYPES 129

4.1 Numbers 130

4.2 Arithmetic 137

4.3 Input and Output 145

4.4 PROBLEM SOLVING First Do it By Hand 152

4.5 Strings 154

5.4 Nested Branches 196

5.5 PROBLEM SOLVING Flowcharts 203

5.6 PROBLEM SOLVING Selecting Test Cases 206

5.7 Boolean Variables and Operators 209

5.8 APPLICATION Input Validation 214

6 LOOPS 237

6.1 The while Loop 238

6.2 PROBLEM SOLVING Hand-Tracing 245

6.3 The for Loop 250

6.4 The do Loop 258

6.5 APPLICATION Processing Sentinel Values 259

6.6 PROBLEM SOLVING Storyboards 265

6.7 Common Loop Algorithms 268

6.8 Nested Loops 275

6.9 APPLICATION Random Numbers and Simulations 279

6.10 Using a Debugger 282

7 ARRAYS AND ARRAY LISTS 307

7.1 Arrays 308

7.2 The Enhanced for Loop 317

7.3 Common Array Algorithms 318

7.4 PROBLEM SOLVING Adapting Algorithms 327

7.5 PROBLEM SOLVING Discovering Algorithms by Manipulating Physical Objects 332

7.6 Two-Dimensional Arrays 336

7.7 Array Lists 343

7.8 Regression Testing 352

8 DESIGNING CLASSES 375

8.1 Discovering Classes 376

8.2 Designing Good Methods 377

8.3 PROBLEM SOLVING Patterns for Object Data 386

8.4 Static Variables and Methods 391

8.5 PROBLEM SOLVING Solve a Simpler Problem First 395

8.6 Packages 400

8.7 Unit Test Frameworks 405

9 INHERITANCE 423

9.1 Inheritance Hierarchies 424

9.2 Implementing Subclasses 428

9.3 Overriding Methods 433

9.4 Polymorphism 439

9.5 Object: The Cosmic Superclass 450

10 INTERFACES 465

10.1 Using Interfaces for Algorithm Reuse 466

10.2 Working with Interface Variables 475

10.3 The Comparable Interface 477

10.4 Using Interfaces for Callbacks 482

10.5 Inner Classes 487

10.6 Mock Objects 489

10.7 Event Handling 490

10.8 Building Applications with Buttons 496

10.9 Processing Timer Events 499

10.10 Mouse Events 502

11 INPUT/OUTPUT AND EXCEPTION HANDLING 519

11.1 Reading and Writing Text Files 520

11.2 Text Input and Output 525

11.3 Command Line Arguments 533

11.4 Exception Handling 540

11.5 APPLICATION Handling Input Errors 549

12 OBJECT-ORIENTED DESIGN 565

12.1 Classes and Their Responsibilities 566

12.2 Relationships between Classes 569

12.3 APPLICATION Printing an Invoice 575

13 RECURSION 593

13.1 Triangle Numbers 594

13.2 Recursive Helper Methods 602

13.3 The Efficiency of Recursion 604

13.4 Permutations 609

13.5 Mutual Recursion 614

13.6 Backtracking 620

14 SORTING AND SEARCHING 635

14.1 Selection Sort 636

14.2 Profiling the Selection Sort Algorithm 639

14.3 Analyzing the Performance of the Selection Sort Algorithm 642

14.4 Merge Sort 647

14.5 Analyzing the Merge Sort Algorithm 650

14.6 Searching 654

14.7 PROBLEM SOLVING Estimating the Running Time of an Algorithm 659

14.8 Sorting and Searching in the Java Library 664

15 THE JAVA COLLECTIONS FRAMEWORK 677

15.1 An Overview of the Collections Framework 678

15.2 Linked Lists 681

15.3 Sets 687

15.4 Maps 692

15.5 Stacks, Queues, and Priority Queues 698

15.6 Stack and Queue Applications 701

16 BASIC DATA STRUCTURES 721

16.1 Implementing Linked Lists 722

16.2 Implementing Array Lists 737

16.3 Implementing Stacks and Queues 741

16.4 Implementing a Hash Table 747

17 TREE STRUCTURES 765

17.1 Basic Tree Concepts 766

17.2 Binary Trees 770

17.3 Binary Search Trees 775

17.4 Tree Traversal 784

17.5 Red-Black Trees 790

17.6 Heaps 797

17.7 The Heapsort Algorithm 808

18 GENERIC CLASSES 823

18.1 Generic Classes and Type Parameters 824

18.2 Implementing Generic Types 825

18.3 Generic Methods 829

18.4 Constraining Type Parameters 831

18.5 Type Erasure 835

19 STREAM PROCESSING 845

19.1 The Stream Concept 846

19.2 Producing Streams 848

19.3 Collecting Results 850

19.4 Transforming Streams 852

19.5 Lambda Expressions 855

19.6 The Optional Type 859

19.7 Other Terminal Operations 862

19.8 Primitive-Type Streams 863

19.9 Grouping Results 866

19.10 Common Algorithms Revisited 868

20 GRAPHICAL USER INTERFACES 883

20.1 Layout Management 884

20.2 Processing Text Input 888

20.3 Choices 894

20.4 Menus 905

20.5 Exploring the Swing Documentation 911

21 ADVANCED INPUT/OUTPUT (WEB ONLY)

21.1 Readers, Writers, and Input/Output Streams

21.2 Binary Input and Output

21.3 Random Access

21.4 Object Input and Output Streams

21.5 File and Directory Operations Paths

22 MULTITHREADING (WEB ONLY)

22.1 Running Threads

22.2 Terminating Threads

22.3 Race Conditions

22.4 Synchronizing Object Access

22.5 Avoiding Deadlocks

22.6 APPLICATION Algorithm Animation

23 INTERNET NETWORKING (WEB ONLY)

23.1 The Internet Protocol

23.2 Application Level Protocols

23.3 A Client Program

23.4 A Server Program

23.5 URL Connections

24 RELATIONAL DATABASES (WEB ONLY)

24.1 Organizing Database Information

24.2 Queries

24.3 Installing a Database

24.4 Database Programming in Java

24.5 APPLICATION Entering an Invoice

25 XML (WEB ONLY)

25.1 XML Tags and Documents

25.2 Parsing XML Documents

25.3 Creating XML Documents

25.4 Validating XML Documents

26 WEB APPLICATIONS (WEB ONLY)

26.1 The Architecture of a Web Application

26.2 The Architecture of a JSF Application

26.3 JavaBeans Components

26.4 Navigation between Pages

26.5 JSF Components

26.6 APPLICATION A Three-Tier Application

Appendix A THE BASIC LATIN AND LATIN-1 SUBSETS OF UNICODE A-1

Appendix B JAVA OPERATOR SUMMARY A-5

Appendix C JAVA RESERVED WORD SUMMARY A-7

Appendix D THE JAVA LIBRARY A-9

Appendix E JAVA LANGUAGE CODING GUIDELINES A-39

Appendix F TOOL SUMMARY

Appendix G NUMBER SYSTEMS © Alex Slobodkin/iStockphoto.

Appendix H UML SUMMARY © Alex Slobodkin/iStockphoto.

Appendix I JAVA SYNTAX SUMM© AARleYx S lo bodkin/iStockphoto.

Appendix J HTML SUMMARY © Alex Slobodkin/iStockphoto.

GLOSSARY G-1

INDEX I-1

CREDITS C-1

ALPHABETICAL LIST OF SYNTAX BOXES

Arrays 309

Array Lists 343

Assignment 39

Calling a Superclass Method 433

Cast 141

Catching Exceptions 542

Class Declaration 87

Comparisons 184

Constant Declaration 134

Constructor with Superclass Initializer 438

Declaring a Generic Class 826

Declaring a Generic Method 830

Declaring an Interface 468

for Statement 250

if Statement 180

Implementing an Interface 469

Importing a Class from a Package 52

Input Statement 145

Instance Variable Declaration 81

Java Program 12

Lambda Expressions 855

Object Construction 47

Package Specification 401

Subclass Declaration 430

The Enhanced for Loop 318

The instanceof Operator 453

The throws Clause 545

The try-with-resources Statement 545

Throwing an Exception 540

Two-Dimensional Array Declaration 337

while Statement 239

Variable Declaration 35

Updated for the Diamond Syntax and Java 8 software release. A greater emphasis on problem solving with practical step-by-step illustrations of techniques that can help students devise and evaluate solutions to programming problems.
A new visual approach that motivates the reader and eases navigation including photographs, step-by-step figures, syntax boxes, and example tables. New exercises from science and business engage students with real world applications of Java in different industries.
An early introduction to object-oriented programming techniques, beginning in Chapter 2, provides extensive practice with objects and classes before students are asked to write their own classes. Horstmann’s clear explanations follow the beginner’s thinking process, providing examples and analogies, and anticipating where they may get confused or make mistakes.
The Testing Track identifies and emphasizes the test-driven approach to programming. The Graphics Track integrates optional graphics material into the chapters where it best fits. Self-Check Questions test understanding, not memorization, and can be used as springboards to a deeper discussion of key concepts in each section.
Nearly two hundred programming problems are available in Code Check with instructive feedback and automated grading for students.

This is a three-hole punched, unbound edition.

An early introduction to object-oriented programming techniques, beginning in Chapter 2, provides extensive practice with objects and classes before students are asked to write their own classes.

Horstmann’s clear explanations follow the beginner’s thinking process, providing examples and analogies, and anticipating where they may get confused.

Self-Check Questions test understanding, not memorization, and can be used as springboards to a deeper discussion of key concepts in each section.

This is a three-hole punched, unbound edition.