Description
Efnisyfirlit
- Title Page
- Getting the Most from Your eText
- New to this Edition
- Tips for Using the Interactive Exercises
- A Tour of the Book
- Walkthrough of the Learning Aids
- Acknowledgments
- Quick Reference
- 1. Introduction
- 1.1 Computer Programs
- Self Check
- 1.2 The Anatomy of a Computer
- Self Check
- Computing & Society 1.1 Computers Are Everywhere
- 1.3 The Java Programming Language
- Self Check
- 1.4 Becoming Familiar with Your Programming Environment
- Self Check
- Programming Tip 1.1 Backup Copies
- 1.5 Analyzing Your First Program
- Syntax 1.1 Java Program
- Self Check
- Common Error 1.1 Omitting Semicolons
- 1.6 Errors
- Self Check
- Common Error 1.2 Misspelling Words
- 1.7 Problem Solving: Algorithm Design
- 1.7.1 The Algorithm Concept
- 1.7.2 An Algorithm for Solving an Investment Problem
- 1.7.3 Pseudocode
- 1.7.4 From Algorithms to Programs
- Self Check
- How To 1.1 Describing an Algorithm with Pseudocode
- Worked Example 1.1 Writing an Algorithm for Tiling a Floor
- Chapter Summary
- Interactive Review and Practice
- Practice 1.1
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 2. Using Objects
- 2.1 Objects and Classes
- 2.1.1 Using Objects
- 2.1.2 Classes
- Self Check
- 2.2 Variables
- 2.2.1 Variable Declarations
- Syntax 2.1 Variable Declaration
- Self Check
- 2.2.2 Types
- Self Check
- 2.2.3 Names
- Self Check
- 2.2.4 Comments
- Self Check
- 2.2.5 Assignment
- Syntax 2.2 Assignment
- Self Check
- Common Error 2.1 Using Undeclared or Uninitialized Variables
- Common Error 2.2 Confusing Variable Declarations and Assignment Statements
- Programming Tip 2.1 Choose Descriptive Variable Names
- Special Topic 2.1 Variable Type Inference
- 2.3 Calling Methods
- 2.3.1 The Public Interface of a Class
- 2.3.2 Method Arguments
- 2.3.3 Return Values
- 2.3.4 Method Declarations
- Self Check
- Programming Tip 2.2 Learn By Trying
- 2.4 Constructing Objects
- Syntax 2.3 Object Construction
- Self Check
- Common Error 2.3 Trying to Invoke a Constructor Like a Method
- 2.5 Accessor and Mutator Methods
- Self Check
- 2.6 The API Documentation
- 2.6.1 Browsing the API Documentation
- 2.6.2 Packages
- Syntax 2.4 Importing a Class from a Package
- Self Check
- Programming Tip 2.3 Don’t Memorize—Use Online Help
- 2.7 Implementing a Test Program
- Self Check
- Special Topic 2.2 Testing Classes in an Interactive Environment
- Worked Example 2.1 How Many Days Have You Been Alive?
- Worked Example 2.2 Working with Pictures
- 2.8 Object References
- Self Check
- Computing & Society 2.1 Computer Monopoly
- 2.9 Graphical Applications
- 2.9.1 Frame Windows
- 2.9.2 Drawing on a Component
- 2.9.3 Displaying a Component in a Frame
- Self Check
- 2.10 Ellipses, Lines, Text, and Color
- 2.10.1 Ellipses and Circles
- 2.10.2 Lines
- 2.10.3 Drawing Text
- 2.10.4 Colors
- Self Check
- Chapter Summary
- Interactive Review and Practice
- Practice 2.1: Variables and Methods
- Practice 2.2: Using APIs
- Practice 2.3: Graphics Programming
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 3. Implementing Classes
- 3.1 Instance Variables and Encapsulation
- 3.1.1 Instance Variables
- Syntax 3.1 Instance Variable Declaration
- 3.1.2 The Methods of the Counter Class
- 3.1.3 Encapsulation
- Self Check
- 3.2 Specifying the Public Interface of a Class
- 3.2.1 Specifying Methods
- 3.2.2 Specifying Constructors
- Syntax 3.2 Class Declaration
- 3.2.3 Using the Public Interface
- 3.2.4 Commenting the Public Interface
- Self Check
- Common Error 3.1 Declaring a Constructor as void
- Programming Tip 3.1 The javadoc Utility
- 3.3 Providing the Class Implementation
- 3.3.1 Providing Instance Variables
- 3.3.2 Providing Constructors
- 3.3.3 Providing Methods
- Self Check
- Common Error 3.2 Ignoring Parameter Variables
- How To 3.1 Implementing a Class
- Worked Example 3.1 Making a Simple Menu
- 3.4 Unit Testing
- Self Check
- Computing & Society 3.1 Electronic Voting
- 3.5 Problem Solving: Tracing Objects
- Self Check
- 3.6 Local Variables
- Self Check
- Common Error 3.3 Duplicating Instance Variables in Local Variables
- Common Error 3.4 Providing Unnecessary Instance Variables
- Common Error 3.5 Forgetting to Initialize Object References in a Constructor
- 3.7 The this Reference
- Self Check
- Special Topic 3.1 Calling One Constructor from Another
- 3.8 Shape Classes
- Self Check
- How To 3.2 Drawing Graphical Shapes
- Chapter Summary
- Interactive Review and Practice
- Practice 3.1: More Practice with BankAccount
- Practice 3.2: More Practice with Other Classes
- Practice 3.3: Graphics Classes
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 4. Fundamental Data Types
- 4.1 Numbers
- 4.1.1 Number Types
- Self Check
- 4.1.2 Constants
- Syntax 4.1 Constant Declaration
- Self Check
- Programming Tip 4.1 Do Not Use Magic Numbers
- Special Topic 4.1 Big Numbers
- 4.2 Arithmetic
- 4.2.1 Arithmetic Operators
- Self Check
- 4.2.2 Increment and Decrement
- Self Check
- 4.2.3 Integer Division and Remainder
- Self Check
- 4.2.4 Powers and Roots
- Self Check
- 4.2.5 Converting Floating-Point Numbers to Integers
- Syntax 4.2 Cast
- Self Check
- Common Error 4.1 Unintended Integer Division
- Common Error 4.2 Unbalanced Parentheses
- Programming Tip 4.2 Spaces in Expressions
- Special Topic 4.2 Avoiding Negative Remainders
- Special Topic 4.3 Combining Assignment and Arithmetic
- Special Topic 4.4 Instance Methods and Static Methods
- Computing & Society 4.1 Bugs in Silicon
- 4.3 Input and Output
- 4.3.1 Reading Input
- Syntax 4.3 Input Statement
- Self Check
- 4.3.2 Formatted Output
- Self Check
- How To 4.1 Carrying Out Computations
- Worked Example 4.1 Computing the Volume and Surface Area of a Pyramid
- 4.4 Problem Solving: First Do It By Hand
- Self Check
- Worked Example 4.2 Computing Travel Time
- 4.5 Strings
- 4.5.1 The String Type
- 4.5.2 Concatenation
- Self Check
- 4.5.3 String Input
- Self Check
- 4.5.4 Escape Sequences
- 4.5.5 Strings and Characters
- Self Check
- 4.5.6 Substrings
- Self Check
- Programming Tip 4.3 Reading Exception Reports
- Special Topic 4.5 Using Dialog Boxes for Input and Output
- Computing & Society 4.2 International Alphabets and Unicode
- Chapter Summary
- Interactive Review and Practice
- Practice 4.1: Working with Numbers
- Practice 4.2: Strings
- Practice 4.3: Challenging Programming Problems
- Practice 4.4: First Do It By Hand
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 5. Decisions
- 5.1 The if Statement
- Syntax 5.1 if Statement
- Self Check
- Common Error 5.1 A Semicolon After the if Condition
- Programming Tip 5.1 Brace Layout
- Programming Tip 5.2 Always Use Braces
- Programming Tip 5.3 Tabs
- Programming Tip 5.4 Avoid Duplication in Branches
- Special Topic 5.1 The Conditional Operator
- 5.2 Comparing Values
- 5.2.1 Relational Operators
- Syntax 5.2 Comparisons
- 5.2.2 Comparing Floating-Point Numbers
- 5.2.3 Comparing Strings
- 5.2.4 Comparing Objects
- 5.2.5 Testing for null
- Self Check
- Common Error 5.2 Using == to Compare Strings
- How To 5.1 Implementing an if Statement
- Computing & Society 5.1 Dysfunctional Computerized Systems
- Worked Example 5.1 Extracting the Middle
- 5.3 Multiple Alternatives
- Self Check
- Special Topic 5.2 The switch Statement
- 5.4 Nested Branches
- Self Check
- Common Error 5.3 The Dangling else Problem
- Programming Tip 5.5 Hand-Tracing
- Special Topic 5.3 Block Scope
- Special Topic 5.4 Enumeration Types
- 5.5 Problem Solving: Flowcharts
- Self Check
- 5.6 Problem Solving: Selecting Test Cases
- Self Check
- Programming Tip 5.6 Make a Schedule and Make Time for Unexpected Problems
- Special Topic 5.5 Logging
- 5.7 Boolean Variables and Operators
- Self Check
- Common Error 5.4 Combining Multiple Relational Operators
- Common Error 5.5 Confusing && and || Conditions
- Special Topic 5.6 Short-Circuit Evaluation of Boolean Operators
- Special Topic 5.7 De Morgan’s Law
- 5.8 Application: Input Validation
- Self Check
- Computing & Society 5.2 Artificial Intelligence
- Chapter Summary
- Interactive Review and Practice
- Practice 5.1: Simple Conditions
- Practice 5.2: Complex Conditions
- Practice 5.3: Points on a Line and in a Plane
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 6. Loops
- 6.1 The while Loop
- Syntax 6.1 while Statement
- Self Check
- Common Error 6.1 Don’t Think “Are We There Yet?”
- Common Error 6.2 Infinite Loops
- Common Error 6.3 Off-by-One Errors
- 6.2 Problem Solving: Hand-Tracing
- Self Check
- Computing & Society 6.1 Digital Piracy
- 6.3 The for Loop
- Syntax 6.2 for Statement
- Self Check
- Programming Tip 6.1 Use for Loops for Their Intended Purpose Only
- Programming Tip 6.2 Choose Loop Bounds That Match Your Task
- Programming Tip 6.3 Count Iterations
- Special Topic 6.1 Variables Declared in a for Loop Header
- 6.4 The do Loop
- Self Check
- Programming Tip 6.4 Flowcharts for Loops
- 6.5 Application: Processing Sentinel Values
- Self Check
- Special Topic 6.2 Redirection of Input and Output
- Special Topic 6.3 The “Loop and a Half” Problem
- Special Topic 6.4 The break and continue Statements
- 6.6 Problem Solving: Storyboards
- Self Check
- 6.7 Common Loop Algorithms
- 6.7.1 Sum and Average Value
- Self Check
- 6.7.2 Counting Matches
- Self Check
- 6.7.3 Finding the First Match
- Self Check
- 6.7.4 Prompting Until a Match is Found
- Self Check
- 6.7.5 Maximum and Minimum
- Self Check
- 6.7.6 Comparing Adjacent Values
- Self Check
- How To 6.1 Writing a Loop
- Worked Example 6.1 Credit Card Processing
- 6.8 Nested Loops
- Self Check
- Worked Example 6.2 Manipulating the Pixels in an Image
- 6.9 Application: Random Numbers and Simulations
- 6.9.1 Generating Random Numbers
- Self Check
- 6.9.2 The Monte Carlo Method
- Self Check
- 6.10 Using a Debugger
- Self Check
- How To 6.2 Debugging
- Worked Example 6.3 A Sample Debugging Session
- Computing & Society 6.2 The First Bug
- Chapter Summary
- Interactive Review and Practice
- Practice 6.1: Simple while Loops
- Practice 6.2: Loop Tracing
- Practice 6.3: for Loops
- Practice 6.4: do/while Loops
- Practice 6.5: More Complex Loops
- Practice 6.6: Algorithms
- Practice 6.7: Nested Loops
- Practice 6.8: Random Numbers
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 7. Arrays and Array Lists
- 7.1 Arrays
- 7.1.1 Declaring and Using Arrays
- Syntax 7.1 Arrays
- Self Check
- 7.1.2 Array References
- Self Check
- 7.1.3 Using Arrays with Methods
- Self Check
- 7.1.4 Partially Filled Arrays
- Self Check
- Common Error 7.1 Bounds Errors
- Common Error 7.2 Uninitialized and Unfilled Arrays
- Programming Tip 7.1 Use Arrays for Sequences of Related Items
- Programming Tip 7.2 Make Parallel Arrays into Arrays of Objects
- Special Topic 7.1 Methods with a Variable Number of Arguments
- Computing & Society 7.1 Computer Viruses
- 7.2 The Enhanced for Loop
- Syntax 7.2 The Enhanced for Loop
- Self Check
- 7.3 Common Array Algorithms
- 7.3.1 Filling
- Self Check
- 7.3.2 Sum and Average Value
- Self Check
- 7.3.3 Maximum and Minimum
- Self Check
- 7.3.4 Element Separators
- 7.3.5 Linear Search
- Self Check
- 7.3.6 Removing an Element
- Self Check
- 7.3.7 Inserting an Element
- Self Check
- 7.3.8 Swapping Elements
- Self Check
- 7.3.9 Copying Arrays
- Self Check
- 7.3.10 Reading Input
- Common Error 7.3 Underestimating the Size of a Data Set
- Special Topic 7.2 Sorting with the Java Library
- 7.4 Problem Solving: Adapting Algorithms
- Self Check
- How To 7.1 Working with Arrays
- Worked Example 7.1 Rolling the Dice
- 7.5 Problem Solving: Discovering Algorithms by Manipulating Physical Objects
- Self Check
- 7.6 Two-Dimensional Arrays
- 7.6.1 Declaring Two-Dimensional Arrays
- Syntax 7.3 Two-Dimensional Array Declaration
- Self Check
- 7.6.2 Accessing Elements
- Self Check
- 7.6.3 Locating Neighboring Elements
- Self Check
- 7.6.4 Accessing Rows and Columns
- Self Check
- 7.6.5 Two-Dimensional Array Parameters
- Worked Example 7.2 A World Population Table
- Special Topic 7.3 Two-Dimensional Arrays with Variable Row Lengths
- Special Topic 7.4 Multidimensional Arrays
- 7.7 Array Lists
- Syntax 7.4 Array Lists
- 7.7.1 Declaring and Using Array Lists
- Self Check
- 7.7.2 Using the Enhanced for Loop with Array Lists
- Self Check
- 7.7.3 Copying Array Lists
- Self Check
- 7.7.4 Wrappers and Auto-boxing
- Self Check
- 7.7.5 Using Array Algorithms with Array Lists
- Self Check
- 7.7.6 Storing Input Values in an Array List
- Self Check
- 7.7.7 Removing Matches
- Self Check
- 7.7.8 Choosing Between Array Lists and Arrays
- Self Check
- Common Error 7.4 Length and Size
- Special Topic 7.5 The Diamond Syntax
- 7.8 Regression Testing
- Programming Tip 7.3 Batch Files and Shell Scripts
- Computing & Society 7.2 Liability for Software Malfunction
- Chapter Summary
- Interactive Review and Practice
- Practice 7.1: Arrays
- Practice 7.2: Array Algorithms
- Practice 7.3: Two-Dimensional Arrays
- Practice 7.4: Array Lists
- Practice 7.5: Partially Filled Arrays
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 8. Designing Classes
- 8.1 Discovering Classes
- Self Check
- 8.2 Designing Good Methods
- 8.2.1 Providing a Cohesive Public Interface
- Self Check
- 8.2.2 Minimizing Dependencies
- Self Check
- 8.2.3 Separating Accessors and Mutators
- Self Check
- 8.2.4 Minimizing Side Effects
- Self Check
- Programming Tip 8.1 Consistency
- Special Topic 8.1 Call by Value and Call by Reference
- 8.3 Problem Solving: Patterns for Object Data
- 8.3.1 Keeping a Total
- Self Check
- 8.3.2 Counting Events
- Self Check
- 8.3.3 Collecting Values
- Self Check
- 8.3.4 Managing Properties of an Object
- Self Check
- 8.3.5 Modeling Objects with Distinct States
- Self Check
- 8.3.6 Describing the Position of an Object
- Self Check
- 8.4 Static Variables and Methods
- Self Check
- Common Error 8.1 Trying to Access Instance Variables in Static Methods
- Programming Tip 8.2 Minimize the Use of Static Methods
- Special Topic 8.2 Alternative Forms of Instance and Static Variable Initialization
- Special Topic 8.3 Static Imports
- 8.5 Problem Solving: Solve a Simpler Problem First
- Self Check
- 8.6 Packages
- 8.6.1 Organizing Related Classes into Packages
- 8.6.2 Importing Packages
- 8.6.3 Package Names
- Syntax 8.1 Package Specification
- 8.6.4 Packages and Source Files
- Self Check
- Common Error 8.2 Confusing Dots
- Special Topic 8.4 Package Access
- How To 8.1 Programming with Packages
- 8.7 Unit Test Frameworks
- Self Check
- Computing & Society 8.1 Personal Computing
- Chapter Summary
- Interactive Review and Practice
- Practice 8.1: Patterns for Object Data
- Practice 8.2: Solve a Simpler Problem First
- Practice 8.3: Call by Value and Call by Reference
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 9. Inheritance
- 9.1 Inheritance Hierarchies
- Self Check
- Programming Tip 9.1 Use a Single Class for Variation in Values, Inheritance for Variation in Behavior
- 9.2 Implementing Subclasses
- Syntax 9.1 Subclass Declaration
- Self Check
- Common Error 9.1 Replicating Instance Variables from the Superclass
- Common Error 9.2 Confusing Super- and Subclasses
- 9.3 Overriding Methods
- Syntax 9.2 Calling a Superclass Method
- Self Check
- Common Error 9.3 Accidental Overloading
- Common Error 9.4 Forgetting to Use super When Invoking a Superclass Method
- Special Topic 9.1 Calling the Superclass Constructor
- Syntax 9.3 Constructor with Superclass Initializer
- 9.4 Polymorphism
- Self Check
- Special Topic 9.2 Dynamic Method Lookup and the Implicit Parameter
- Special Topic 9.3 Abstract Classes
- Special Topic 9.4 Final Methods and Classes
- Special Topic 9.5 Protected Access
- How To 9.1 Developing an Inheritance Hierarchy
- Worked Example 9.1 Implementing an Employee Hierarchy for Payroll Processing
- 9.5 Object: The Cosmic Superclass
- 9.5.1 Overriding the toString Method
- Self Check
- 9.5.2 The equals Method
- Self Check
- 9.5.3 The instanceof Operator
- Syntax 9.4 The instanceof Operator
- Self Check
- Common Error 9.5 Don’t Use Type Tests
- Special Topic 9.6 Inheritance and the toString Method
- Special Topic 9.7 Inheritance and the equals Method
- Computing & Society 9.1 Who Controls the Internet?
- Chapter Summary
- Interactive Review and Practice
- Practice 9.1: Subclasses
- Practice 9.2: Overriding Methods
- Practice 9.3: Polymorphism
- Practice 9.4: The Object Class
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 10. Interfaces
- 10.1 Using Interfaces for Algorithm Reuse
- 10.1.1 Discovering an Interface Type
- 10.1.2 Declaring an Interface Type
- Syntax 10.1 Declaring an Interface
- 10.1.3 Implementing an Interface Type
- Syntax 10.2 Implementing an Interface
- 10.1.4 Comparing Interfaces and Inheritance
- Self Check
- Common Error 10.1 Forgetting to Declare Implementing Methods as Public
- Common Error 10.2 Trying to Instantiate an Interface
- Special Topic 10.1 Constants in Interfaces
- Special Topic 10.2 Nonabstract Interface Methods
- 10.2 Working with Interface Types
- 10.2.1 Converting from Classes to Interfaces
- 10.2.2 Invoking Methods on Interface Variables
- 10.2.3 Casting from Interfaces to Classes
- Self Check
- Worked Example 10.1 Investigating Number Sequences
- 10.3 The Comparable Interface
- Self Check
- Programming Tip 10.1 Comparing Integers and Floating-Point Numbers
- Special Topic 10.3 The clone Method and the Cloneable Interface
- 10.4 Using Interfaces for Callbacks
- Self Check
- Special Topic 10.4 Lambda Expressions
- Special Topic 10.5 Generic Interface Types
- 10.5 Inner Classes
- Self Check
- 10.6 Mock Objects
- Self Check
- 10.7 Event Handling
- 10.7.1 Listening to Events
- 10.7.2 Using Inner Classes for Listeners
- Self Check
- Common Error 10.3 Modifying Parameter Types in the Implementing Method
- Common Error 10.4 Trying to Call Listener Methods
- 10.8 Building Applications with Buttons
- Self Check
- Common Error 10.5 Forgetting to Attach a Listener
- 10.9 Processing Timer Events
- Self Check
- Common Error 10.6 Forgetting to Repaint
- 10.10 Mouse Events
- Self Check
- Special Topic 10.6 Keyboard Events
- Special Topic 10.7 Event Adapters
- Computing & Society 10.1 Open Source and Free Software
- Chapter Summary
- Interactive Review and Practice
- Practice 10.1: Simple Interfaces
- Practice 10.2: Callbacks
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 11. Input/Output and Exception Handling
- 11.1 Reading and Writing Text Files
- Self Check
- Common Error 11.1 Backslashes in File Names
- Common Error 11.2 Constructing a Scanner with a String
- Special Topic 11.1 Reading Web Pages
- Special Topic 11.2 File Dialog Boxes
- Special Topic 11.3 Character Encodings
- 11.2 Text Input and Output
- 11.2.1 Reading Words
- Self Check
- 11.2.2 Reading Characters
- Self Check
- 11.2.3 Classifying Characters
- Self Check
- 11.2.4 Reading Lines
- Self Check
- 11.2.5 Scanning a String
- Self Check
- 11.2.6 Converting Strings to Numbers
- Self Check
- 11.2.7 Avoiding Errors When Reading Numbers
- Self Check
- 11.2.8 Mixing Number, Word, and Line Input
- Self Check
- 11.2.9 Formatting Output
- Self Check
- Special Topic 11.4 Regular Expressions
- Special Topic 11.5 Reading an Entire File
- 11.3 Command Line Arguments
- Self Check
- How To 11.1 Processing Text Files
- Computing & Society 11.1 Encryption Algorithms
- Worked Example 11.1 Analyzing Baby Names
- 11.4 Exception Handling
- 11.4.1 Throwing Exceptions
- Syntax 11.1 Throwing an Exception
- Self Check
- 11.4.2 Catching Exceptions
- Syntax 11.2 Catching Exceptions
- Self Check
- 11.4.3 Checked Exceptions
- Syntax 11.3 The throws Clause
- Self Check
- 11.4.4 Closing Resources
- Syntax 11.4 The try-with-resources Statement
- Self Check
- 11.4.5 Designing Your Own Exception Types
- Programming Tip 11.1 Throw Early, Catch Late
- Programming Tip 11.2 Do Not Squelch Exceptions
- Programming Tip 11.3 Do Throw Specific Exceptions
- Special Topic 11.6 Assertions
- Special Topic 11.7 The try/finally Statement
- 11.5 Application: Handling Input Errors
- Computing & Society 11.2 The Ariane Rocket Incident
- Chapter Summary
- Interactive Review and Practice
- Practice 11.1: Processing Text Files
- Practice 11.2: Complex Text Input and Output
- Practice 11.3: Exception Handling
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 12. Object-Oriented Design
- 12.1 Classes and Their Responsibilities
- 12.1.1 Discovering Classes
- 12.1.2 The CRC Card Method
- Self Check
- 12.2 Relationships Between Classes
- 12.2.1 Dependency
- 12.2.2 Aggregation
- 12.2.3 Inheritance
- Self Check
- How To 12.1 Using CRC Cards and UML Diagrams in Program Design
- Special Topic 12.1 Attributes and Methods in UML Diagrams
- Special Topic 12.2 Multiplicities
- Special Topic 12.3 Aggregation, Association, and Composition
- 12.3 Application: Printing an Invoice
- 12.3.1 Requirements
- 12.3.2 CRC Cards
- 12.3.3 UML Diagrams
- 12.3.4 Method Documentation
- 12.3.5 Implementation
- Self Check
- Worked Example 12.1 Simulating an Automatic Teller Machine
- Computing & Society 12.1 Electronic Privacy
- Chapter Summary
- Interactive Review and Practice
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 13. Recursion
- 13.1 Triangle Numbers
- Self Check
- Common Error 13.1 Infinite Recursion
- Common Error 13.2 Tracing Through Recursive Methods
- How To 13.1 Thinking Recursively
- Worked Example 13.1 Finding Files
- 13.2 Recursive Helper Methods
- Self Check
- 13.3 The Efficiency of Recursion
- Self Check
- 13.4 Permutations
- Self Check
- Computing & Society 13.1 The Limits of Computation
- 13.5 Mutual Recursion
- Self Check
- 13.6 Backtracking
- Self Check
- Worked Example 13.2 Towers of Hanoi
- Chapter Summary
- Interactive Review and Practice
- Practice 13.1: Simple Recursion Problems
- Practice 13.2: Complex Recursion Problems
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 14. Sorting and Searching
- 14.1 Selection Sort
- Self Check
- 14.2 Profiling the Selection Sort Algorithm
- Self Check
- 14.3 Analyzing the Performance of the Selection Sort Algorithm
- Self Check
- Special Topic 14.1 Oh, Omega, and Theta
- Special Topic 14.2 Insertion Sort
- 14.4 Merge Sort
- Self Check
- 14.5 Analyzing the Merge Sort Algorithm
- Self Check
- Special Topic 14.3 >The Quicksort Algorithm
- 14.6 Searching
- 14.6.1 Linear Search
- 14.6.2 Binary Search
- Self Check
- Computing & Society 14.1 The First Programmer
- 14.7 Problem Solving: Estimating the Running Time of an Algorithm
- 14.7.1 Linear Time
- 14.7.2 Quadratic Time
- 14.7.3 The Triangle Pattern
- 14.7.4 Logarithmic Time
- Self Check
- 14.8 Sorting and Searching in the Java Library
- 14.8.1 Sorting
- 14.8.2 Binary Search
- 14.8.3 Comparing Objects
- Self Check
- Common Error 14.1 The compareTo Method Can Return Any Integer, Not Just –1, 0, and 1
- Special Topic 14.4 The Comparator Interface
- Special Topic 14.5 Comparators with Lambda Expressions
- Worked Example 14.1 Enhancing the Insertion Sort Algorithm
- Chapter Summary
- Interactive Review and Practice
- Practice 14.1: Additional Practice
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 15. The Java Collections Framework
- 15.1 An Overview of the Collections Framework
- Self Check
- 15.2 Linked Lists
- 15.2.1 The Structure of Linked Lists
- 15.2.2 The LinkedList Class of the Java Collections Framework
- 15.2.3 List Iterators
- Self Check
- Computing & Society 15.1 Standardization
- 15.3 Sets
- 15.3.1 Choosing a Set Implementation
- 15.3.2 Working with Sets
- Self Check
- Programming Tip 15.1 Use Interface References to Manipulate Data Structures
- 15.4 Maps
- Self Check
- Special Topic 15.1 Updating Map Entries
- How To 15.1 Choosing a Collection
- Worked Example 15.1 Word Frequency
- Special Topic 15.2 Hash Functions
- 15.5 Stacks, Queues, and Priority Queues
- 15.5.1 Stacks
- 15.5.2 Queues
- 15.5.3 Priority Queues
- Self Check
- 15.6 Stack and Queue Applications
- 15.6.1 Balancing Parentheses
- 15.6.2 Evaluating Reverse Polish Expressions
- 15.6.3 Evaluating Algebraic Expressions
- 15.6.4 Backtracking
- Self Check
- Special Topic 15.3 Reverse Polish Notation
- Worked Example 15.2 Simulating a Queue of Waiting Customers
- Chapter Summary
- Interactive Review and Practice
- Practice 15.1: Lists and Sets
- Practice 15.2: Maps
- Practice 15.3: Stacks and Queues
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 16. Basic Data Structures
- 16.1 Implementing Linked Lists
- 16.1.1 The Node Class
- 16.1.2 Adding and Removing the First Element
- 16.1.3 The Iterator Class
- 16.1.4 Advancing an Iterator
- 16.1.5 Removing an Element
- 16.1.6 Adding an Element
- 16.1.7 Setting an Element to a Different Value
- 16.1.8 Efficiency of Linked List Operations
- Self Check
- Special Topic 16.1 Static Classes
- Worked Example 16.1 Implementing a Doubly-Linked List
- 16.2 Implementing Array Lists
- 16.2.1 Getting and Setting Elements
- 16.2.2 Removing or Adding Elements
- 16.2.3 Growing the Internal Array
- Self Check
- 16.3 Implementing Stacks and Queues
- 16.3.1 Stacks as Linked Lists
- 16.3.2 Stacks as Arrays
- 16.3.3 Queues as Linked Lists
- 16.3.4 Queues as Circular Arrays
- Self Check
- 16.4 Implementing a Hash Table
- 16.4.1 Hash Codes
- 16.4.2 Hash Tables
- 16.4.3 Finding an Element
- 16.4.4 Adding and Removing Elements
- 16.4.5 Iterating over a Hash Table
- Self Check
- Special Topic 16.2 Open Addressing
- Chapter Summary
- Interactive Review and Practice
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 17. Tree Structures
- 17.1 Basic Tree Concepts
- Self Check
- 17.2 Binary Trees
- 17.2.1 Binary Tree Examples
- 17.2.2 Balanced Trees
- 17.2.3 A Binary Tree Implementation
- Self Check
- Worked Example 17.1 Building a Huffman Tree
- 17.3 Binary Search Trees
- 17.3.1 The Binary Search Property
- 17.3.2 Insertion
- 17.3.3 Removal
- 17.3.4 Efficiency of the Operations
- Self Check
- 17.4 Tree Traversal
- 17.4.1 Inorder Traversal
- 17.4.2 Preorder and Postorder Traversals
- 17.4.3 The Visitor Pattern
- 17.4.4 Depth-First and Breadth-First Search
- 17.4.5 Tree Iterators
- Self Check
- 17.5 Red-Black Trees
- 17.5.1 Basic Properties of Red-Black Trees
- 17.5.2 Insertion
- 17.5.3 Removal
- Self Check
- Worked Example 17.2 Implementing a Red-Black Tree
- 17.6 Heaps
- Self Check
- 17.7 The Heapsort Algorithm
- Self Check
- Chapter Summary
- Interactive Review and Practice
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 18. Generic Classes
- 18.1 Generic Classes and Type Parameters
- Self Check
- 18.2 Implementing Generic Types
- Syntax 18.1 Declaring a Generic Class
- Self Check
- 18.3 Generic Methods
- Syntax 18.2 Declaring a Generic Method
- Self Check
- 18.4 Constraining Type Parameters
- Self Check
- Common Error 18.1 Genericity and Inheritance
- Common Error 18.2 The Array Store Exception
- Special Topic 18.1 Wildcard Types
- 18.5 Type Erasure
- Self Check
- Common Error 18.3 Using Generic Types in a Static Context
- Special Topic 18.2 Reflection
- Worked Example 18.1 Making a Generic Binary Search Tree Class
- Chapter Summary
- Interactive Review and Practice
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 19. Stream Processing
- 19.1 The Stream Concept
- Self Check
- 19.2 Producing Streams
- Self Check
- 19.3 Collecting Results
- Self Check
- Programming Tip 19.1 One Stream Operation Per Line
- Special Topic 19.1 Infinite Streams
- 19.4 Transforming Streams
- Self Check
- Common Error 19.1 Don’t Use a Terminated Stream
- 19.5 Lambda Expressions
- Syntax 19.1 Lambda Expressions
- Self Check
- Programming Tip 19.2 Keep Lambda Expressions Short
- Special Topic 19.2 Method and Constructor References
- Special Topic 19.3 Higher-Order Functions
- Special Topic 19.4 Higher-Order Functions and Comparators
- 19.6 The Optional Type
- Self Check
- Common Error 19.2 Optional Results Without Values
- 19.7 Other Terminal Operations
- Self Check
- Common Error 19.3 Don’t Apply Mutations in Parallel Stream Operations
- 19.8 Primitive-Type Streams
- 19.8.1 Creating Primitive-Type Streams
- 19.8.2 Mapping a Primitive-Type Stream
- 19.8.3 Processing Primitive-Type Streams
- Self Check
- 19.9 Grouping Results
- Self Check
- 19.10 Common Algorithms Revisited
- 19.10.1 Filling
- 19.10.2 Sum, Average, Maximum, and Minimum
- 19.10.3 Counting Matches
- 19.10.4 Element Separators
- 19.10.5 Linear Search
- 19.10.6 Comparing Adjacent Values
- Self Check
- How To 19.1 Working with Streams
- Worked Example 19.1 Word Properties
- Worked Example 19.2 A Movie Database
- Chapter Summary
- Interactive Review and Practice
- Practice 19.1: Simple Stream Processing
- Practice 19.2: More Simple Stream Processing
- Practice 19.3: Lambdas and Optionals
- Practice 19.4: Complex Stream Operations
- Chapter Review
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 20. Graphical User Interfaces
- 20.1 Layout Management
- 20.1.1 Using Layout Managers
- 20.1.2 Achieving Complex Layouts
- 20.1.3 Using Inheritance to Customize Frames
- Common Error 20.1 By Default, Components Have Zero Width and Height
- Special Topic 20.1 Adding the main Method to the Frame Class
- 20.2 Processing Text Input
- 20.2.1 Text Fields
- 20.2.2 Text Areas
- 20.3 Choices
- 20.3.1 Radio Buttons
- 20.3.2 Check Boxes
- 20.3.3 Combo Boxes
- How To 20.1 Laying Out a User Interface
- Worked Example 20.1 Programming a Working Calculator
- Programming Tip 20.1 Use a GUI Builder
- 20.4 Menus
- 20.5 Exploring the Swing Documentation
- Chapter Summary
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 21. Advanced Input/Output
- 21.1 Readers, Writers, and Input/Output Streams
- 21.2 Binary Input and Output
- Common Error 21.1 Negative byte Values
- 21.3 Random Access
- 21.4 Object Input and Output Streams
- How To 21.1 Choosing a File Format
- 21.5 File and Directory Operations
- 21.5.1 Paths
- 21.5.2 Creating and Deleting Files and Directories
- 21.5.3 Useful File Operations
- 21.5.4 Visiting Directories
- Chapter Summary
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 22. Multithreading
- 22.1 Running Threads
- Programming Tip 22.1 Use the Runnable Interface
- Special Topic 22.1 Thread Pools
- 22.2 Terminating Threads
- Programming Tip 22.2 Check for Thread Interruptions in the run Method of a Thread
- 22.3 Race Conditions
- 22.4 Synchronizing Object Access
- 22.5 Avoiding Deadlocks
- Common Error 22.1 Calling await Without Calling signalAll
- Common Error 22.2 Calling signalAll Without Locking the Object
- Special Topic 22.2 Object Locks and Synchronized Methods
- Special Topic 22.3 The Java Memory Model
- 22.6 Application: Algorithm Animation
- Chapter Summary
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 23. Internet Networking
- 23.1 The Internet Protocol
- 23.2 Application Level Protocols
- 23.3 A Client Program
- 23.4 A Server Program
- How To 23.1 Designing Client/Server Programs
- 23.5 URL Connections
- Programming Tip 23.1 Use High-Level Libraries
- Chapter Summary
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 24. Relational Databases
- 24.1 Organizing Database Information
- 24.1.1 Database Tables
- 24.1.2 Linking Tables
- 24.1.3 Implementing Multi-Valued Relationships
- Programming Tip 24.1 Stick with the Standard
- Programming Tip 24.2 Avoid Unnecessary Data Replication
- Programming Tip 24.3 Don’t Replicate Columns in a Table
- Special Topic 24.1 Primary Keys and Indexes
- 24.2 Queries
- 24.2.1 Simple Queries
- 24.2.2 Selecting Columns
- 24.2.3 Selecting Subsets
- 24.2.4 Calculations
- 24.2.5 Joins
- 24.2.6 Updating and Deleting Data
- Common Error 24.1 Joining Tables Without Specifying a Link Condition
- 24.3 Installing a Database
- 24.4 Database Programming in Java
- 24.4.1 Connecting to the Database
- 24.4.2 Executing SQL Statements
- 24.4.3 Analyzing Query Results
- 24.4.4 Result Set Metadata
- Common Error 24.2 Constructing Queries from Arbitrary Strings
- Programming Tip 24.4 Don’t Hardwire Database Connection Parameters into Your Program
- Programming Tip 24.5 Let the Database Do the Work
- 24.5 Application: Entering an Invoice
- Special Topic 24.2 Transactions
- Special Topic 24.3 Object-Relational Mapping
- Worked Example 24.1 Programming a Bank Database
- Chapter Summary
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- 25. XML
- 25.1 XML Tags and Documents
- 25.1.1 Advantages of XML
- 25.1.2 Differences Between XML and HTML
- 25.1.3 The Structure of an XML Document
- How To 25.1 Designing an XML Document Format
- Programming Tip 25.1 Prefer XML Elements over Attributes
- Programming Tip 25.2 Avoid Children with Mixed Elements and Text
- 25.2 Parsing XML Documents
- Common Error 25.1 XML Elements Describe Objects, Not Classes
- 25.3 Creating XML Documents
- How To 25.2 Writing an XML Document
- Special Topic 25.1 Grammars, Parsers, and Compilers
- 25.4 Validating XML Documents
- 25.4.1 Document Type Definitions
- 25.4.2 Specifying a DTD in an XML Document
- 25.4.3 Parsing and Validation
- How To 25.3 Writing a DTD
- Special Topic 25.2 Schema Languages
- Special Topic 25.3 Other XML Technologies
- Chapter Summary
- End-of-Chapter Exercises
- Review Exercises
- Practice Exercises
- Programming Projects
- Appendices
- Appendix A: The Basic Latin and Latin-1 Subsets of Unicode
- Appendix B: Java Operator Summary
- Appendix C: Java Reserved Word Summary
- Appendix D: The Java Library
- Package java.awt
- Package java.awt.event
- Package java.awt.geom
- Package java.io
- Package java.lang
- Package java.math
- Package java.net
- Package java.nio.file
- Package java.sql
- Package java.text
- Package java.util
- Package java.util.concurrent.locks
- Package java.util.function
- Package java.util.logging
- Package java.util.stream
- Package javax.sql
- Package javax.swing
- Package javax.swing.border
- Package javax.swing.event
- Package javax.swing.text
- Package javax.xml.parsers
- Package javax.xml.xpath
- Package org.w3c.dom
- Package org.w3c.dom.ls
- Appendix E: Java Language Coding Guidelines
- Introduction
- Source Files
- Classes
- Methods
- Variables and Constants
- Control Flow
- Lexical Issues
- Appendix F: Tool Summary
- The Java Compiler
- The Java Virtual Machine Launcher
- The JAR Tool
- The javadoc Tool
- Documentation Comments
- Appendix G: Number Systems
- Binary Numbers
- Overflow and Roundoff Errors
- Two’s Complement Integers
- IEEE Floating-Point Numbers
- Hexadecimal Numbers
- Bit and Shift Operations
- Appendix H: UML Summary
- CRC Cards
- UML Diagrams
- Appendix I: Java Syntax Summary
- Types
- Variables
- Expressions
- Classes
- Interfaces
- Enumeration Types
- Methods
- Constructors
- Statements
- Exceptions
- Packages
- Generic Types and Methods
- Comments
- Appendix J: HTML Summary
- Glossary
- Illustration Credits
- Wiley End User License Agreement
Reviews
There are no reviews yet.