You are previewing Java™ SE 8 for Programmers, Third Edition.
O'Reilly logo
Java™ SE 8 for Programmers, Third Edition

Book Description

The professional programmer’s Deitel® guide to Java™ SE 7 and SE 8 (Java 8) development with the powerful Java™ platform

¿

Written for programmers with a background in high-level language programming, this book applies the Deitel signature live-code approach to teaching programming and explores the Java™ language and Java™ APIs in depth. The book presents¿ concepts in the context of fully tested programs, complete with syntax shading, code highlighting, line-by-line code walkthroughs and program outputs. The book features hundreds of complete Java™ programs with thousands of lines of proven Java™ code, and hundreds of tips that will help you build robust applications.

¿

Start with an introduction to Java™ using an early classes and objects approach, then rapidly move on to more advanced topics, including GUI, graphics, exception handling, lambdas, streams, functional interfaces, object serialization, concurrency, generics, generic collections, JDBC™ and more. You’ll enjoy the Deitels’ classic treatment of object-oriented programming and the object-oriented design ATM case study, including a complete Java™ implementation. When you’re finished, you’ll have everything you need to build industrial-strength object-oriented¿¿ Java™ SE 7 and SE 8 (Java 8) applications.

¿

Practical, Example-Rich Coverage of:

• Java™ SE 7 and SE 8 (Java 8)

• Lambdas, Streams, Functional Interfaces with Default and Static Methods

• Classes, Objects, Encapsulation,¿ Inheritance, Polymorphism, Interfaces

• Swing and JavaFX GUIs; Graphics

• Integrated Exception Handling

• Files, Streams, Object Serialization

• Multithreading and Concurrency for Optimal Multi-Core Performance

• Generics and Generic Collections

• Database (JDBC™, SQL and JavaDB)

• Using the Debugger and the API Docs

• Industrial-Strength, Object-Oriented Design ATM Case Study and more.

¿

Visit www.deitel.com

• Download code examples

• For information on Deitel’s Dive Into® Series programming training courses delivered at organizations worldwide visit www.deitel.com/training or¿ write to deitel@deitel.com

• Join the Deitel social networking communities on Facebook® at¿ facebook.com/DeitelFan,¿ Twitter® @deitel, Google+™ at google.com/+DeitelFan,¿¿ LinkedIn® at bit.ly/DeitelLinkedIn, YouTube™ at¿ youtube.com/user/DeitelTV

• Subscribe to the Deitel® Buzz Online e-mail newsletter at¿ www.deitel.com/newsletter/ subscribe.html

¿

Table of Contents

  1. About This eBook
  2. Title Page
  3. Copyright Page
  4. Deitel® Series Page
  5. Dedication Page
  6. Contents
  7. Foreword
  8. Preface
    1. Keeping in Touch with the Authors
    2. Modular Organization
      1. Introduction
      2. Additional Programming Fundamentals
      3. Object-Oriented Programming
      4. Swing and JavaFX Graphical User Interfaces; Java 2D Graphics
      5. Generic Collections, Lambdas and Streams
      6. Concurrency/Database
      7. Object-Oriented Design
    3. New and Updated Features
      1. Swing and JavaFX GUI; Java 2D Graphics
      2. Concurrency
      3. Getting Monetary Amounts Right
      4. Object Technology
      5. Generic Collections
      6. Database
    4. Secure Java Programming
    5. Teaching Approach
    6. Software Used in Java SE 8 for Programmers, 3/e
    7. Java Fundamentals: Parts I, II, III and IV LiveLessons, Second Edition, Video Training Product
    8. Acknowledgments
      1. Reviewers
    9. A Special Thank You to Brian Goetz
    10. About the Authors
    11. About Deitel® & Associates, Inc.
  9. Before You Begin
    1. Font and Naming Conventions
    2. Software Used in the Book
      1. Java Standard Edition Development Kit 7 (JDK 7)
      2. Java Standard Edition Development Kit (JDK) 8
    3. JDK Installation Instructions
    4. Setting the PATH Environment Variable
      1. JDK Installation Directory and the bin Subdirectory
    5. Setting the CLASSPATH Environment Variable
    6. Setting the JAVA_HOME Environment Variable
    7. Java Integrated Development Environments (IDEs)
      1. NetBeans Downloads
      2. Eclipse Downloads
      3. IntelliJ IDEA Community Edition Downloads
    8. Obtaining the Code Examples
    9. Java’s Nimbus Look-and-Feel
  10. 1. Introduction to Java and Test-Driving a Java Application
    1. 1.1. Introduction
      1. Java Standard Edition
      2. Java Enterprise Edition
      3. Java Micro Edition
    2. 1.2. Object Technology Concepts
      1. 1.2.1. The Automobile as an Object
      2. 1.2.2. Methods and Classes
      3. 1.2.3. Instantiation
      4. 1.2.4. Reuse
      5. 1.2.5. Messages and Method Calls
      6. 1.2.6. Attributes and Instance Variables
      7. 1.2.7. Encapsulation and Information Hiding
      8. 1.2.8. Inheritance
      9. 1.2.9. Interfaces
      10. 1.2.10. Object-Oriented Analysis and Design (OOAD)
      11. 1.2.11. The UML (Unified Modeling Language)
    3. 1.3. Open Source Software
      1. Android
    4. 1.4. Java
      1. Java Class Libraries
    5. 1.5. A Typical Java Development Environment
      1. Phase 1: Creating a Program
      2. Phase 2: Compiling a Java Program into Bytecodes
      3. Phase 3: Loading a Program into Memory
      4. Phase 4: Bytecode Verification
      5. Phase 5: Execution
      6. Problems That May Occur at Execution Time
    6. 1.6. Test-Driving a Java Application
    7. 1.7. Software Technologies
    8. 1.8. Keeping Up-to-Date with Information Technologies
  11. 2. Introduction to Java Applications; Input/Output and Operators
    1. 2.1. Introduction
    2. 2.2. Your First Program in Java: Printing a Line of Text
      1. Commenting Your Programs
      2. Using Blank Lines
      3. Declaring a Class
      4. Filename for a public Class
      5. Class Names and Identifiers
      6. Class Body
      7. Declaring a Method
      8. Performing Output with System.out.println
      9. Compiling Your First Java Application
      10. Executing the Welcome1 Application
    3. 2.3. Modifying Your First Java Program
      1. Displaying a Single Line of Text with Multiple Statements
      2. Displaying Multiple Lines of Text with a Single Statement
    4. 2.4. Displaying Text with printf
    5. 2.5. Another Application: Adding Integers
      1. import Declarations
      2. Declaring Class Addition
      3. Declaring and Creating a Scanner to Obtain User Input from the Keyboard
      4. Declaring Variables to Store Integers
      5. Prompting the User for Input
      6. Obtaining ints as Input from the User
      7. Using Variables in a Calculation
      8. Displaying the Result of the Calculation
      9. Java API Documentation
    6. 2.6. Arithmetic
      1. Rules of Operator Precedence
    7. 2.7. Decision Making: Equality and Relational Operators
      1. Operators Discussed So Far
    8. 2.8. Wrap-Up
  12. 3. Introduction to Classes, Objects, Methods and Strings
    1. 3.1. Introduction
    2. 3.2. Instance Variables, set Methods and get Methods
      1. 3.2.1. Account Class with an Instance Variable, a set Method and a get Method
      2. 3.2.2. AccountTest Class That Creates and Uses an Object of Class Account
      3. 3.2.3. Compiling and Executing an App with Multiple Classes
      4. 3.2.4. Account UML Class Diagram with an Instance Variable and set and get Methods
      5. 3.2.5. Additional Notes on Class AccountTest
      6. 3.2.6. Software Engineering with private Instance Variables and public set and get Methods
    3. 3.3. Primitive Types vs. Reference Types
    4. 3.4. Account Class: Initializing Objects with Constructors
      1. 3.4.1. Declaring an Account Constructor for Custom Object Initialization
      2. 3.4.2. Class AccountTest: Initializing Account Objects When They’re Created
    5. 3.5. Account Class with a Balance; Floating-Point Numbers
      1. 3.5.1. Account Class with a balance Instance Variable of Type double
      2. 3.5.2. AccountTest Class to Use Class Account
    6. 3.6. Wrap-Up
  13. 4. Control Statements: Part 1; Assignment, ++ and -- Operators
    1. 4.1. Introduction
    2. 4.2. Control Structures
      1. Sequence Structure in Java
      2. Selection Statements in Java
      3. Repetition Statements in Java
      4. Summary of Control Statements in Java
    3. 4.3. if Single-Selection Statement
      1. UML Activity Diagram for an if Statement
    4. 4.4. if...else Double-Selection Statement
      1. UML Activity Diagram for an if...else Statement
      2. Nested if...else Statements
      3. Dangling-else Problem
      4. Blocks
      5. Conditional Operator (?:)
    5. 4.5. Student Class: Nested if...else Statements
      1. Class Student
      2. Class StudentTest
    6. 4.6. while Repetition Statement
      1. UML Activity Diagram for a while Statement
    7. 4.7. Counter-Controlled Repetition
      1. Program with Counter-Controlled Repetition
      2. Implementing Counter-Controlled Repetition
      3. Local Variables in Method main
      4. Initialization Phase: Initializing Variables total and gradeCounter
      5. Processing Phase: Reading 10 Grades from the User
      6. Termination Phase: Calculating and Displaying the Class Average
      7. Notes on Integer Division and Truncation
      8. A Note About Arithmetic Overflow
      9. A Deeper Look at Receiving User Input
    8. 4.8. Sentinel-Controlled Repetition
      1. Implementing Sentinel-Controlled Repetition
      2. Program Logic for Sentinel-Controlled Repetition vs. Counter-Controlled Repetition
      3. Braces in a while statement
      4. Explicitly and Implicitly Converting Between Primitive Types
      5. Floating-Point Number Precision
    9. 4.9. Nested Control Statements
    10. 4.10. Compound Assignment Operators
    11. 4.11. Increment and Decrement Operators
      1. Difference Between Prefix Increment and Postfix Increment Operators
      2. Simplifying Statements with the Arithmetic Compound Assignment, Increment and Decrement Operators
      3. Operator Precedence and Associativity
    12. 4.12. Primitive Types
    13. 4.13. Wrap-Up
  14. 5. Control Statements: Part 2; Logical Operators
    1. 5.1. Introduction
    2. 5.2. Essentials of Counter-Controlled Repetition
    3. 5.3. for Repetition Statement
      1. A Closer Look at the for Statement’s Header
      2. General Format of a for Statement
      3. Representing a for Statement with an Equivalent while Statement
      4. Scope of a for Statement’s Control Variable
      5. Expressions in a for Statement’s Header Are Optional
      6. Placing Arithmetic Expressions in a for Statement’s Header
      7. Using a for Statement’s Control Variable in the Statement’s Body
      8. UML Activity Diagram for the for Statement
    4. 5.4. Examples Using the for Statement
      1. Application: Summing the Even Integers from 2 to 20
      2. Application: Compound-Interest Calculations
      3. Formatting Strings with Field Widths and Justification
      4. Performing the Interest Calculations with static Method pow of Class Math
      5. Formatting Floating-Point Numbers
      6. A Warning about Displaying Rounded Values
    5. 5.5. do...while Repetition Statement
      1. Braces in a do...while Repetition Statement
      2. UML Activity Diagram for the do...while Repetition Statement
    6. 5.6. switch Multiple-Selection Statement
      1. Using a switch Statement to Count A, B, C, D and F Grades
      2. Reading Grades from the User
      3. Processing the Grades
      4. case without a break Statement
      5. The default Case
      6. Displaying the Grade Report
      7. switch Statement UML Activity Diagram
      8. Notes on the Expression in Each case of a switch
    7. 5.7. Class AutoPolicy Case Study: Strings in switch Statements
      1. Class AutoPolicy
      2. Class AutoPolicyTest
    8. 5.8. break and continue Statements
      1. break Statement
      2. continue Statement
    9. 5.9. Logical Operators
      1. Conditional AND (&&) Operator
      2. Conditional OR (||) Operator
      3. Short-Circuit Evaluation of Complex Conditions
      4. Boolean Logical AND (&) and Boolean Logical Inclusive OR (|) Operators
      5. Boolean Logical Exclusive OR (^)
      6. Logical Negation (!) Operator
      7. Logical Operators Example
      8. Precedence and Associativity of the Operators Presented So Far
    10. 5.10. Wrap-Up
  15. 6. Methods: A Deeper Look
    1. 6.1. Introduction
    2. 6.2. Program Modules in Java
    3. 6.3. static Methods, static Fields and Class Math
      1. Math Class Methods
      2. static Variables
      3. Math Class static Constants PI and E
      4. Why Is Method main Declared static?
    4. 6.4. Declaring Methods with Multiple Parameters
      1. Keywords public and static
      2. Method maximum
      3. Implementing Method maximum by Reusing Method Math.max
      4. Assembling Strings with String Concatenation
    5. 6.5. Notes on Declaring and Using Methods
    6. 6.6. Argument Promotion and Casting
    7. 6.7. Java API Packages
    8. 6.8. Case Study: Secure Random-Number Generation
      1. Moving to Secure Random Numbers
      2. A Note About Performance
      3. Creating a SecureRandom Object
      4. Obtaining a Random int Value
      5. Changing the Range of Values Produced By nextInt
      6. Rolling a Six-Sided Die
      7. Rolling a Six-Sided Die 20 Times
      8. Rolling a Six-Sided Die 6,000,000 Times
      9. Generalized Scaling and Shifting of Random Numbers
    9. 6.9. Case Study: A Game of Chance; Introducing enum Types
      1. Method rollDice
      2. Method main’s Local Variables
      3. enum Type Status
      4. Logic of the main Method
      5. Why Some Constants Are Not Defined as enum Constants
    10. 6.10. Scope of Declarations
      1. Principle of Least Privilege
    11. 6.11. Method Overloading
      1. Declaring Overloaded Methods
      2. Distinguishing Between Overloaded Methods
      3. Return Types of Overloaded Methods
    12. 6.12. Wrap-Up
  16. 7. Arrays and ArrayLists
    1. 7.1. Introduction
      1. Java SE 8
    2. 7.2. Arrays
      1. Logical Array Representation
    3. 7.3. Declaring and Creating Arrays
    4. 7.4. Examples Using Arrays
      1. 7.4.1. Creating and Initializing an Array
      2. 7.4.2. Using an Array Initializer
      3. 7.4.3. Calculating the Values to Store in an Array
      4. 7.4.4. Summing the Elements of an Array
      5. 7.4.5. Using Bar Charts to Display Array Data Graphically
      6. 7.4.6. Using the Elements of an Array as Counters
      7. 7.4.7. Using Arrays to Analyze Survey Results
    5. 7.5. Exception Handling: Processing the Incorrect Response
      1. 7.5.1. The try Statement
      2. 7.5.2. Executing the catch Block
      3. 7.5.3. toString Method of the Exception Parameter
    6. 7.6. Case Study: Card Shuffling and Dealing Simulation
      1. Class Card
      2. Class DeckOfCards
      3. DeckOfCards Constructor
      4. DeckOfCards Method shuffle
      5. DeckOfCards Method dealCard
      6. Shuffling and Dealing Cards
      7. Preventing NullPointerExceptions
    7. 7.7. Enhanced for Statement
      1. Java SE 8
    8. 7.8. Passing Arrays to Methods
    9. 7.9. Pass-By-Value vs. Pass-By-Reference
    10. 7.10. Case Study: Class GradeBook Using an Array to Store Grades
      1. Storing Student Grades in an Array in Class GradeBook
      2. Class GradeBookTest That Demonstrates Class GradeBook
      3. Java SE 8
    11. 7.11. Multidimensional Arrays
      1. Arrays of One-Dimensional Arrays
      2. Two-Dimensional Arrays with Rows of Different Lengths
      3. Creating Two-Dimensional Arrays with Array-Creation Expressions
      4. Two-Dimensional Array Example: Displaying Element Values
      5. Common Multidimensional-Array Manipulations Performed with for Statements
    12. 7.12. Case Study: Class GradeBook Using a Two-Dimensional Array
      1. Storing Student Grades in a Two-Dimensional Array in Class GradeBook
      2. Methods getMinimum and getMaximum
      3. Method outputBarChart
      4. Method outputGrades
      5. Method getAverage
      6. Class GradeBookTest That Demonstrates Class GradeBook
    13. 7.13. Variable-Length Argument Lists
    14. 7.14. Using Command-Line Arguments
    15. 7.15. Class Arrays
      1. Java SE 8—Class Arrays Method parallelSort
    16. 7.16. Introduction to Collections and Class ArrayList
      1. Demonstrating an ArrayList<String>
      2. Java SE 7—Diamond (<>) Notation for Creating an Object of a Generic Class
    17. 7.17. Wrap-Up
  17. 8. Classes and Objects: A Deeper Look
    1. 8.1. Introduction
    2. 8.2. Time Class Case Study
      1. Time1 Class Declaration
      2. Default Constructor
      3. Method setTime and Throwing Exceptions
      4. Method toUniversalString
      5. Method toString
      6. Using Class Time1
      7. Calling Time1 Method setTime with Invalid Values
      8. Software Engineering of the Time1 Class Declaration
      9. Java SE 8—Date/Time API
    3. 8.3. Controlling Access to Members
    4. 8.4. Referring to the Current Object’s Members with the this Reference
    5. 8.5. Time Class Case Study: Overloaded Constructors
      1. Class Time2 with Overloaded Constructors
      2. Class Time2’s Constructors—Calling One Constructor from Another via this
      3. Class Time2’s setTime Method
      4. Notes Regarding Class Time2’s set and get Methods and Constructors
      5. Using Class Time2’s Overloaded Constructors
    6. 8.6. Default and No-Argument Constructors
    7. 8.7. Notes on Set and Get Methods
      1. Set and Get Methods vs. public Data
      2. Validity Checking in Set Methods
      3. Predicate Methods
    8. 8.8. Composition
      1. Class Date
      2. Class Employee
      3. Class EmployeeTest
    9. 8.9. enum Types
      1. Declaring Instance Variables, a Constructor and Methods in an enum Type
      2. Using enum type Book
    10. 8.10. Garbage Collection
      1. A Note about Class Object’s finalize Method
    11. 8.11. static Class Members
      1. Motivating static
      2. Class Scope
      3. static Methods Cannot Directly Access Instance Variables and Instance Methods
      4. Tracking the Number of Employee Objects That Have Been Created
      5. Class EmployeeTest
    12. 8.12. static Import
      1. static Import Forms
      2. Demonstrating static Import
    13. 8.13. final Instance Variables
    14. 8.14. Time Class Case Study: Creating Packages
      1. Steps for Declaring a Reusable Class
      2. Steps 1 and 2: Creating a public Class and Adding the package Statement
      3. Package Naming Conventions
      4. Fully Qualified Names
      5. Step 3: Compiling the Packaged Class
      6. Step 4: Importing Types from Your Package
      7. Single-Type-Import vs. Type-Import-On-Demand Declarations
      8. Specifying the Classpath When Compiling a Program
      9. Specifying the Classpath When Executing a Program
    15. 8.15. Package Access
    16. 8.16. Using BigDecimal for Precise Monetary Calculations
      1. Interest Calculations Using BigDecimal
      2. Creating BigDecimal Objects
      3. Performing the Interest Calculations with BigDecimal
      4. Formatting Currency Values with NumberFormat
      5. Rounding BigDecimal Values
      6. Scaling BigDecimal Values
    17. 8.17. Wrap-Up
  18. 9. Object-Oriented Programming: Inheritance
    1. 9.1. Introduction
    2. 9.2. Superclasses and Subclasses
      1. University Community Member Hierarchy
      2. Shape Hierarchy
    3. 9.3. protected Members
    4. 9.4. Relationship Between Superclasses and Subclasses
      1. 9.4.1. Creating and Using a CommissionEmployee Class
      2. 9.4.2. Creating and Using a BasePlusCommissionEmployee Class
      3. 9.4.3. Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy
      4. 9.4.4. CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables
      5. 9.4.5. CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables
    5. 9.5. Constructors in Subclasses
    6. 9.6. Class Object
    7. 9.7. Wrap-Up
  19. 10. Object-Oriented Programming: Polymorphism and Interfaces
    1. 10.1. Introduction
      1. Implementing for Extensibility
      2. Chapter Overview
      3. Programming in the Specific
      4. Interfaces
      5. 10.2. Polymorphism Examples
      6. Quadrilaterals
      7. Space Objects in a Video Game
    2. 10.3. Demonstrating Polymorphic Behavior
    3. 10.4. Abstract Classes and Methods
      1. Purpose of Abstract Classes
      2. Declaring an Abstract Class and Abstract Methods
      3. Using Abstract Classes to Declare Variables
      4. Layered Software Systems
    4. 10.5. Case Study: Payroll System Using Polymorphism
      1. 10.5.1. Abstract Superclass Employee
      2. 10.5.2. Concrete Subclass SalariedEmployee
      3. 10.5.3. Concrete Subclass HourlyEmployee
      4. 10.5.4. Concrete Subclass CommissionEmployee
      5. 10.5.5. Indirect Concrete Subclass BasePlusCommissionEmployee
      6. 10.5.6. Polymorphic Processing, Operator instanceof and Downcasting
    5. 10.6. Allowed Assignments Between Superclass and Subclass Variables
    6. 10.7. final Methods and Classes
      1. Final Methods Cannot Be Overridden
      2. Final Classes Cannot Be Superclasses
    7. 10.8. A Deeper Explanation of Issues with Calling Methods from Constructors
    8. 10.9. Creating and Using Interfaces
      1. Standardizing Interactions
      2. Software Objects Communicate Via Interfaces
      3. Using an Interface
      4. Relating Disparate Types
      5. Interfaces vs. Abstract Classes
      6. Tagging Interfaces
      7. 10.9.1. Developing a Payable Hierarchy
      8. 10.9.2. Interface Payable
      9. 10.9.3. Class Invoice
      10. 10.9.4. Modifying Class Employee to Implement Interface Payable
      11. 10.9.5. Modifying Class SalariedEmployee for Use in the Payable Hierarchy
      12. 10.9.6. Using Interface Payable to Process Invoices and Employees Polymorphically
      13. 10.9.7. Some Common Interfaces of the Java API
    9. 10.10. Java SE 8 Interface Enhancements
      1. 10.10.1. default Interface Methods
      2. 10.10.2. static Interface Methods
      3. 10.10.3. Functional Interfaces
    10. 10.11. Wrap-Up
  20. 11. Exception Handling: A Deeper Look
    1. 11.1. Introduction
    2. 11.2. Example: Divide by Zero without Exception Handling
      1. Stack Trace
      2. Stack Trace for an ArithmeticException
      3. Stack Trace for an InputMismatchException
      4. Program Termination
    3. 11.3. Example: Handling ArithmeticExceptions and InputMismatchExceptions
      1. Enclosing Code in a try Block
      2. Catching Exceptions
      3. Multi-catch
      4. Uncaught Exceptions
      5. Termination Model of Exception Handling
      6. Using the throws Clause
    4. 11.4. When to Use Exception Handling
    5. 11.5. Java Exception Hierarchy
      1. Checked vs. Unchecked Exceptions
      2. RuntimeExceptions Are Unchecked Exceptions
      3. Checked Exceptions
      4. The Compiler and Checked Exceptions
      5. The Compiler and Unchecked Exceptions
      6. Catching Subclass Exceptions
      7. Only the First Matching catch Executes
    6. 11.6. finally Block
      1. When the finally Block Executes
      2. Releasing Resources in a finally Block
      3. Demonstrating the finally Block
      4. Throwing Exceptions Using the throw Statement
      5. Rethrowing Exceptions
    7. 11.7. Stack Unwinding and Obtaining Information from an Exception Object
      1. Stack Unwinding
      2. Obtaining Data from an Exception Object
    8. 11.8. Chained Exceptions
      1. Program Flow of Control
      2. Program Output
    9. 11.9. Declaring New Exception Types
      1. A New Exception Type Must Extend an Existing One
    10. 11.10. Preconditions and Postconditions
      1. Preconditions
      2. Postconditions
      3. Throwing Exceptions When Preconditions or Postconditions Are Not Met
    11. 11.11. Assertions
    12. 11.12. try-with-Resources: Automatic Resource Deallocation
    13. 11.13. Wrap-Up
  21. 12. Swing GUI Components: Part 1
    1. 12.1. Introduction
      1. IDE Support for GUI Design
      2. Sample GUI: The SwingSet3 Demo Application
    2. 12.2. Java’s Nimbus Look-and-Feel
    3. 12.3. Simple GUI-Based Input/Output with JOptionPane
      1. Input Dialogs
      2. Converting Strings to int Values
      3. Message Dialogs
      4. JOptionPane Message Dialog Constants
    4. 12.4. Overview of Swing Components
      1. Swing vs. AWT
      2. Lightweight vs. Heavyweight GUI Components
      3. Superclasses of Swing’s Lightweight GUI Components
    5. 12.5. Displaying Text and Images in a Window
      1. Labeling GUI Components
      2. Specifying the Layout
      3. Creating and Attaching label1
      4. The Icon Interface and Class ImageIcon
      5. Loading an Image Resource
      6. Creating and Attaching label2
      7. Creating and Attaching label3
      8. Creating and Displaying a LabelFrame Window
    6. 12.6. Text Fields and an Introduction to Event Handling with Nested Classes
      1. Creating the GUI
      2. Steps Required to Set Up Event Handling for a GUI Component
      3. Using a Nested Class to Implement an Event Handler
      4. Inner Class TextFieldHandler
      5. Registering the Event Handler for Each Text Field
      6. Details of Class TextFieldHandler’s actionPerformed Method
      7. Class TextFieldTest
      8. Java SE 8: Implementing Event Listeners with Lambdas
    7. 12.7. Common GUI Event Types and Listener Interfaces
    8. 12.8. How Event Handling Works
      1. Registering Events
      2. Event-Handler Invocation
    9. 12.9. JButton
      1. Accessing the this Reference in an Object of a Top-Level Class from an Inner Class
    10. 12.10. Buttons That Maintain State
      1. 12.10.1. JCheckBox
      2. 12.10.2. JRadioButton
    11. 12.11. JComboBox; Using an Anonymous Inner Class for Event Handling
      1. Using an Anonymous Inner Class for Event Handling
      2. Java SE 8: Implementing Anonymous Inner Classes with Lambdas
    12. 12.12. JList
    13. 12.13. Multiple-Selection Lists
    14. 12.14. Mouse Event Handling
      1. Tracking Mouse Events on a JPanel
    15. 12.15. Adapter Classes
      1. Extending MouseAdapter
    16. 12.16. JPanel Subclass for Drawing with the Mouse
      1. Method paintComponent
      2. Defining the Custom Drawing Area
      3. Using the Custom JPanel in an Application
    17. 12.17. Key Event Handling
    18. 12.18. Introduction to Layout Managers
      1. 12.18.1. FlowLayout
      2. 12.18.2. BorderLayout
      3. 12.18.3. GridLayout
    19. 12.19. Using Panels to Manage More Complex Layouts
    20. 12.20. JTextArea
      1. JScrollPane Scrollbar Policies
    21. 12.21. Wrap-Up
  22. 13. Graphics and Java 2D
    1. 13.1. Introduction
    2. 13.2. Graphics Contexts and Graphics Objects
    3. 13.3. Color Control
      1. Drawing in Different Colors
    4. 13.4. Manipulating Fonts
      1. Font Metrics
    5. 13.5. Drawing Lines, Rectangles and Ovals
    6. 13.6. Drawing Arcs
    7. 13.7. Drawing Polygons and Polylines
    8. 13.8. Java 2D API
      1. Lines, Rectangles, Round Rectangles, Arcs and Ellipses
      2. Ovals, Gradient Fills and Paint Objects
      3. Rectangles, Strokes
      4. Rounded Rectangles, BufferedImages and TexturePaint Objects
      5. Arcs
      6. Lines
      7. Creating Your Own Shapes with General Paths
    9. 13.9. Wrap-Up
  23. 14. Strings, Characters and Regular Expressions
    1. 14.1. Introduction
    2. 14.2. Fundamentals of Characters and Strings
    3. 14.3. Class String
      1. 14.3.1. String Constructors
      2. 14.3.2. String Methods length, charAt and getChars
      3. 14.3.3. Comparing Strings
      4. 14.3.4. Locating Characters and Substrings in Strings
      5. 14.3.5. Extracting Substrings from Strings
      6. 14.3.6. Concatenating Strings
      7. 14.3.7. Miscellaneous String Methods
      8. 14.3.8. String Method valueOf
    4. 14.4. Class StringBuilder
      1. 14.4.1. StringBuilder Constructors
      2. 14.4.2. StringBuilder Methods length, capacity, setLength and ensureCapacity
      3. 14.4.3. StringBuilder Methods charAt, setCharAt, getChars and reverse
      4. 14.4.4. StringBuilder append Methods
      5. 14.4.5. StringBuilder Insertion and Deletion Methods
    5. 14.5. Class Character
    6. 14.6. Tokenizing Strings
    7. 14.7. Regular Expressions, Class Pattern and Class Matcher
      1. Quantifiers
      2. Replacing Substrings and Splitting Strings
      3. Classes Pattern and Matcher
      4. Java SE 8
    8. 14.8. Wrap-Up
  24. 15. Files, Streams and Object Serialization
    1. 15.1. Introduction
    2. 15.2. Files and Streams
      1. Byte-Based and Character-Based Streams
      2. Standard Input, Standard Output and Standard Error Streams
      3. The java.io and java.nio Packages
      4. Java SE 8 Adds Another Type of Stream
    3. 15.3. Using NIO Classes and Interfaces to Get File and Directory Information
      1. Creating Path Objects
      2. Absolute vs. Relative Paths
      3. Getting Path Objects from URIs
      4. Example: Getting File and Directory Information
      5. Separator Characters
    4. 15.4. Sequential-Access Text Files
      1. 15.4.1. Creating a Sequential-Access Text File
      2. 15.4.2. Reading Data from a Sequential-Access Text File
      3. 15.4.3. Case Study: A Credit-Inquiry Program
      4. 15.4.4. Updating Sequential-Access Files
    5. 15.5. Object Serialization
      1. Classes ObjectInputStream and ObjectOutputStream
      2. Interfaces ObjectOutput and ObjectInput
      3. 15.5.1. Creating a Sequential-Access File Using Object Serialization
      4. 15.5.2. Reading and Deserializing Data from a Sequential-Access File
    6. 15.6. Opening Files with JFileChooser
    7. 15.7. (Optional) Additional java.io Classes
      1. 15.7.1. Interfaces and Classes for Byte-Based Input and Output
      2. 15.7.2. Interfaces and Classes for Character-Based Input and Output
    8. 15.8. Wrap-Up
  25. 16. Generic Collections
    1. 16.1. Introduction
      1. Java SE 8
    2. 16.2. Collections Overview
      1. Object-Based Collections
      2. Generic Collections
      3. Choosing a Collection
    3. 16.3. Type-Wrapper Classes
    4. 16.4. Autoboxing and Auto-Unboxing
    5. 16.5. Interface Collection and Class Collections
    6. 16.6. Lists
      1. 16.6.1. ArrayList and Iterator
      2. 16.6.2. LinkedList
    7. 16.7. Collections Methods
      1. 16.7.1. Method sort
      2. 16.7.2. Method shuffle
      3. 16.7.3. Methods reverse, fill, copy, max and min
      4. 16.7.4. Method binarySearch
      5. 16.7.5. Methods addAll, frequency and disjoint
    8. 16.8. Stack Class of Package java.util
    9. 16.9. Class PriorityQueue and Interface Queue
    10. 16.10. Sets
      1. Sorted Sets
    11. 16.11. Maps
      1. Map Implementation with Hash Tables
    12. 16.12. Properties Class
    13. 16.13. Synchronized Collections
    14. 16.14. Unmodifiable Collections
    15. 16.15. Abstract Implementations
    16. 16.16. Wrap-Up
  26. 17. Java SE 8 Lambdas and Streams
    1. 17.1. Introduction
    2. 17.2. Functional Programming Technologies Overview
      1. External Iteration Is Error Prone
      2. Internal Iteration
      3. 17.2.1. Functional Interfaces
      4. 17.2.2. Lambda Expressions
      5. 17.2.3. Streams
    3. 17.3. IntStream Operations
      1. 17.3.1. Creating an IntStream and Displaying Its Values with the forEach Terminal Operation
      2. 17.3.2. Terminal Operations count, min, max, sum and average
      3. 17.3.3. Terminal Operation reduce
      4. 17.3.4. Intermediate Operations: Filtering and Sorting IntStream Values
      5. 17.3.5. Intermediate Operation: Mapping
      6. 17.3.6. Creating Streams of ints with IntStream Methods range and rangeClosed
    4. 17.4. Stream<Integer> Manipulations
      1. 17.4.1. Creating a Stream<Integer>
      2. 17.4.2. Sorting a Stream and Collecting the Results
      3. 17.4.3. Filtering a Stream and Storing the Results for Later Use
      4. 17.4.4. Filtering and Sorting a Stream and Collecting the Results
      5. 17.4.5. Sorting Previously Collected Results
    5. 17.5. Stream<String> Manipulations
      1. 17.5.1. Mapping Strings to Uppercase Using a Method Reference
      2. 17.5.2. Filtering Strings Then Sorting Them in Case-Insensitive Ascending Order
      3. 17.5.3. Filtering Strings Then Sorting Them in Case-Insensitive Descending Order
    6. 17.6. Stream<Employee> Manipulations
      1. 17.6.1. Creating and Displaying a List<Employee>
      2. 17.6.2. Filtering Employees with Salaries in a Specified Range
      3. 17.6.3. Sorting Employees By Multiple Fields
      4. 17.6.4. Mapping Employees to Unique Last Name Strings
      5. 17.6.5. Grouping Employees By Department
      6. 17.6.6. Counting the Number of Employees in Each Department
      7. 17.6.7. Summing and Averaging Employee Salaries
    7. 17.7. Creating a Stream<String> from a File
      1. Summarizing the Occurrences of Each Word in the File
      2. Displaying the Summary Grouped by Starting Letter
    8. 17.8. Generating Streams of Random Values
      1. Creating an IntStream of Random Values
      2. Converting an IntStream to a Stream<Integer>
      3. Summarizing the Die Frequencies
      4. Displaying the Results
    9. 17.9. Lambda Event Handlers
    10. 17.10. Additional Notes on Java SE 8 Interfaces
      1. Java SE 8 Interfaces Allow Inheritance of Method Implementations
      2. Java SE 8: @FunctionalInterface Annotation
    11. 17.11. Java SE 8 and Functional Programming Resources
    12. 17.12. Wrap-Up
  27. 18. Generic Classes and Methods
    1. 18.1. Introduction
    2. 18.2. Motivation for Generic Methods
      1. Common Features in the Overloaded printArray Methods
    3. 18.3. Generic Methods: Implementation and Compile-Time Translation
      1. Type Parameter Section of a Generic Method
      2. Testing the Generic printArray Method
      3. Erasure at Compilation Time
    4. 18.4. Additional Compile-Time Translation Issues: Methods That Use a Type Parameter as the Return Type
      1. Generic Method maximum and Specifying a Type Parameter’s Upper Bound
      2. Calling Method maximum
      3. Erasure and the Upper Bound of a Type Parameter
    5. 18.5. Overloading Generic Methods
    6. 18.6. Generic Classes
      1. Implementing a Generic Stack Class
      2. Testing the Generic Stack Class of Fig. 18.7
      3. Methods testPushDouble and testPopDouble
      4. Methods testPushInteger and testPopInteger
      5. Creating Generic Methods to Test Class Stack<T>
    7. 18.7. Raw Types
      1. Using Raw Types with Generic Class Stack
      2. Compiler Warnings
    8. 18.8. Wildcards in Methods That Accept Type Parameters
      1. Implementing Method sum With a Wildcard Type Argument in Its Parameter
    9. 18.9. Wrap-Up
  28. 19. Swing GUI Components: Part 2
    1. 19.1. Introduction
      1. Java SE 8: Implementing Event Listeners with Lambdas
    2. 19.2. JSlider
    3. 19.3. Understanding Windows in Java
      1. Returning Window Resources to the System
      2. Displaying and Positioning Windows
      3. Window Events
    4. 19.4. Using Menus with Frames
      1. Overview of Several Menu-Related Components
      2. Using Menus in an Application
      3. Setting Up the File Menu
      4. Setting Up the Format Menu
      5. Creating the Rest of the GUI and Defining the Event Handlers
    5. 19.5. JPopupMenu
    6. 19.6. Pluggable Look-and-Feel
    7. 19.7. JDesktopPane and JInternalFrame
    8. 19.8. JTabbedPane
    9. 19.9. BoxLayout Layout Manager
      1. Creating Box Containers
      2. Struts
      3. Glue
      4. Rigid Areas
      5. Setting a BoxLayout for a Container
      6. Adding Glue and JButtons
      7. Creating the JTabbedPane
      8. Attaching the Box Containers and JPanel to the JTabbedPane
    10. 19.10. GridBagLayout Layout Manager
      1. GridBagConstraints
      2. GridBagConstraints Field anchor
      3. GridBagConstraints Field fill
      4. GridBagConstraints Fields gridx and gridy
      5. GridBagConstraints Field gridwidth
      6. GridBagConstraints Field weightx
      7. GridBagConstraints Field weighty
      8. Effects of weightx and weighty
      9. Demonstrating GridBagLayout
      10. GUI Overview
      11. JTextArea textArea1
      12. JButton button1
      13. JComboBox comboBox
      14. JButton button2
      15. JButton button3
      16. JTextField textField and JTextArea textArea2
      17. Method addComponent
      18. GridBagConstraints Constants RELATIVE and REMAINDER
      19. Setting the JFrame’s Layout to a GridBagLayout
      20. Configuring the JTextField
      21. Configuring JButton buttons[0]
      22. Configuring JButton buttons[1]
      23. Configuring JButton buttons[2]
      24. Configuring JComboBox
      25. Configuring JButton buttons[3]
      26. Configuring JButton buttons[4]
      27. Configuring JList
    11. 19.11. Wrap-Up
  29. 20. Concurrency
    1. 20.1. Introduction
      1. Java Concurrency
      2. Concurrent Programming Uses
      3. Concurrent Programming Is Difficult
      4. Use the Prebuilt Classes of the Concurrency APIs Whenever Possible
    2. 20.2. Thread States and Life Cycle
      1. 20.2.1. New and Runnable States
      2. 20.2.2. Waiting State
      3. 20.2.3. Timed Waiting State
      4. 20.2.4. Blocked State
      5. 20.2.5. Terminated State
      6. 20.2.6. Operating-System View of the Runnable State
      7. 20.2.7. Thread Priorities and Thread Scheduling
      8. 20.2.8. Indefinite Postponement and Deadlock
    3. 20.3. Creating and Executing Threads with the Executor Framework
      1. Creating Concurrent Tasks with the Runnable Interface
      2. Executing Runnable Objects with an Executor
      3. Using Class Executors to Obtain an ExecutorService
      4. Implementing the Runnable Interface
      5. Let the Thread Handle InterruptedExceptions
      6. Using the ExecutorService to Manage Threads that Execute PrintTasks
      7. Main Thread
      8. Sample Outputs
      9. Waiting for Previously Scheduled Tasks to Terminate
    4. 20.4. Thread Synchronization
      1. 20.4.1. Immutable Data
      2. 20.4.2. Monitors
      3. 20.4.3. Unsynchronized Mutable Data Sharing
      4. 20.4.4. Synchronized Mutable Data Sharing—Making Operations Atomic
    5. 20.5. Producer/Consumer Relationship without Synchronization
      1. Examples of Producer/Consumer Relationship
      2. Synchronization and State Dependence
      3. Logic Errors from Lack of Synchronization
      4. Interface Buffer
      5. Class Producer
      6. Class Consumer
      7. We Call Thread Method sleep Only for Demonstration Purposes
      8. Class UnsynchronizedBuffer Does Not Synchronize Access to the Buffer
      9. Class SharedBufferTest
    6. 20.6. Producer/Consumer Relationship: ArrayBlockingQueue
      1. Class BlockingBuffer
      2. Class BlockingBufferTest
    7. 20.7. (Advanced) Producer/Consumer Relationship with synchronized, wait, notify and notifyAll
      1. Methods wait, notify and notifyAll
      2. Class SynchronizedBuffer
      3. Fields and Methods of Class SynchronizedBuffer
      4. Method blockingPut and the Producer Thread
      5. Method blockingGet and the Consumer Thread
      6. Method displayState Is Also synchronized
      7. Testing Class SynchronizedBuffer
    8. 20.8. (Advanced) Producer/Consumer Relationship: Bounded Buffers
      1. Bounded Buffers
      2. Bounded Buffers Using ArrayBlockingQueue
      3. Implementing Your Own Bounded Buffer as a Circular Buffer
      4. CircularBuffer Method blockingPut
      5. CircularBuffer Method blockingGet
      6. CircularBuffer Method displayState
      7. Testing Class CircularBuffer
    9. 20.9. (Advanced) Producer/Consumer Relationship: The Lock and Condition Interfaces
      1. Interface Lock and Class ReentrantLock
      2. Condition Objects and Interface Condition
      3. Lock and Condition vs. the synchronized Keyword
      4. Using Locks and Conditions to Implement Synchronization
      5. Class SynchronizedBuffer
      6. Class SharedBufferTest2
    10. 20.10. Concurrent Collections
    11. 20.11. Multithreading with GUI: SwingWorker
      1. Class SwingWorker
      2. 20.11.1. Performing Computations in a Worker Thread: Fibonacci Numbers
      3. 20.11.2. Processing Intermediate Results: Sieve of Eratosthenes
    12. 20.12. sort/parallelSort Timings with the Java SE 8 Date/Time API
      1. Creating the Arrays
      2. Timing Arrays Method sort with Date/Time API Classes Instant and Duration
      3. Timing Arrays Method parallelSort with Date/Time API Classes Instant and Duration
      4. Displaying the Percentage Difference Between the Sorting Times
      5. Other Parallel Array Operations
    13. 20.13. Java SE 8: Sequential vs. Parallel Streams
      1. Performing Stream Operations with Separate Passes of a Sequential Stream
      2. Performing Stream Operations with a Single Pass of a Sequential Stream
      3. Performing Stream Operations with a Single Pass of a Parallel Stream
    14. 20.14. (Advanced) Interfaces Callable and Future
      1. Executing Aysnchronous Tasks with CompletableFuture
      2. Class TimeData
      3. Method startFibonacci for Performing and Timing Fibonacci Calculations
      4. Performing Fibonacci Calculations Synchronously
      5. Performing Fibonacci Calculations Asynchronously
      6. Getting the Asynchronous Calculations’ Results
      7. Program Outputs
    15. 20.15. (Advanced) Fork/Join Framework
    16. 20.16. Wrap-Up
  30. 21. Accessing Databases with JDBC
    1. 21.1. Introduction
      1. Structured Query Language
      2. Popular Relational Database Management Systems
      3. JDBC
    2. 21.2. Relational Databases
      1. Selecting Data Subsets
    3. 21.3. A books Database
      1. Authors Table
      2. Titles Table
      3. AuthorISBN Table
      4. Entity-Relationship (ER) Diagram
    4. 21.4. SQL
      1. 21.4.1. Basic SELECT Query
      2. 21.4.2. WHERE Clause
      3. 21.4.3. ORDER BY Clause
      4. 21.4.4. Merging Data from Multiple Tables: INNER JOIN
      5. 21.4.5. INSERT Statement
      6. 21.4.6. UPDATE Statement
      7. 21.4.7. DELETE Statement
    5. 21.5. Setting up a Java DB Database
      1. JDK Installation Folders
      2. Java DB Configuration
      3. 21.5.1. Creating the Chapter’s Databases on Windows
      4. 21.5.2. Creating the Chapter’s Databases on Mac OS X
      5. 21.5.3. Creating the Chapter’s Databases on Linux
    6. 21.6. Manipulating Databases with JDBC
      1. 21.6.1. Connecting to and Querying a Database
      2. 21.6.2. Querying the books Database
    7. 21.7. RowSet Interface
      1. Connected and Disconnected RowSets
      2. Using a RowSet
    8. 21.8. PreparedStatements
      1. Address Book Application that Uses PreparedStatements
      2. Class Person
      3. Class PersonQueries
      4. Creating PreparedStatements
      5. PersonQueries Method getAllPeople
      6. PersonQueries Methods addPerson and Close
      7. Class AddressBookDisplay
    9. 21.9. Stored Procedures
    10. 21.10. Transaction Processing
    11. 21.11. Wrap-Up
  31. 22. JavaFX GUI
    1. 22.1. Introduction
      1. History of GUI in Java
      2. JavaFX Version Used in This Chapter
    2. 22.2. JavaFX Scene Builder and the NetBeans IDE
      1. What is FXML?
    3. 22.3. JavaFX App Window Structure
    4. 22.4. Welcome App—Displaying Text and an Image
      1. 22.4.1. Creating the App’s Project
      2. 22.4.2. NetBeans Projects Window—Viewing the Project Contents
      3. 22.4.3. Adding an Image to the Project
      4. 22.4.4. Opening JavaFX Scene Builder from NetBeans
      5. 22.4.5. Changing to a VBox Layout Container
      6. 22.4.6. Configuring the VBox Layout Container
      7. 22.4.7. Adding and Configuring a Label
      8. 22.4.8. Adding and Configuring an ImageView
      9. 22.4.9. Running the Welcome App
    5. 22.5. Tip Calculator App—Introduction to Event Handling
      1. 22.5.1. Test-Driving the Tip Calculator App
      2. 22.5.2. Technologies Overview
      3. 22.5.3. Building the App’s GUI
      4. 22.5.4. TipCalculator Class
      5. 22.5.5. TipCalculatorController Class
    6. 22.6. Wrap-Up
  32. 23. ATM Case Study, Part 1: Object-Oriented Design with the UML
    1. 23.1. Case Study Introduction
    2. 23.2. Examining the Requirements Document
      1. Requirements Document
      2. Analyzing the ATM System
      3. Use Case Diagrams
      4. Designing the ATM System
      5. Web Resource
      6. Self-Review Exercises for Section 23.2
    3. 23.3. Identifying the Classes in a Requirements Document
      1. Identifying the Classes in a System
      2. Modeling Classes
      3. Self-Review Exercises for Section 23.3
    4. 23.4. Identifying Class Attributes
      1. Identifying Attributes
      2. Modeling Attributes
      3. Self-Review Exercises for Section 23.4
    5. 23.5. Identifying Objects’ States and Activities
      1. State Machine Diagrams
      2. Activity Diagrams
      3. Self-Review Exercises for Section 23.5
    6. 23.6. Identifying Class Operations
      1. Modeling Operations
      2. Authenticating a User
      3. Other BankDatabase and Account Operations
      4. Getting the Balances
      5. Crediting and Debiting an Account
      6. Deposit Confirmations Performed by Another Banking System
      7. Displaying Messages
      8. Keyboard Input
      9. Dispensing Cash
      10. Class ATM
      11. Identifying and Modeling Operation Parameters for Class BankDatabase
      12. Identifying and Modeling Operation Parameters for Class Account
      13. Identifying and Modeling Operation Parameters for Class Screen
      14. Identifying and Modeling Operation Parameters for Class CashDispenser
      15. Identifying and Modeling Operation Parameters for Other Classes
      16. Self-Review Exercises for Section 23.6
    7. 23.7. Indicating Collaboration Among Objects
      1. Identifying the Collaborations in a System
      2. Interaction Diagrams
      3. Communication Diagrams
      4. Sequence of Messages in a Communication Diagram
      5. Sequence Diagrams
      6. Self-Review Exercises for Section 23.7
    8. 23.8. Wrap-Up
      1. Answers to Self-Review Exercises
  33. 24. ATM Case Study Part 2: Implementing an ObjectOriented Design
    1. 24.1. Introduction
    2. 24.2. Starting to Program the Classes of the ATM System
      1. Visibility
      2. Navigability
      3. Implementing the ATM System from Its UML Design
      4. Self-Review Exercises for Section 24.2
    3. 24.3. Incorporating Inheritance and Polymorphism into the ATM System
      1. Generalization
      2. Processing Transactions Polymorphically
      3. Additional Attribute of Classes Withdrawal and Deposit
      4. Class Diagram with Transaction Hierarchy Incorporated
      5. Implementing the ATM System Design (Incorporating Inheritance)
      6. Self-Review Exercises for Section 24.3
    4. 24.4. ATM Case Study Implementation
      1. 24.4.1. Class ATM
      2. 24.4.2. Class Screen
      3. 24.4.3. Class Keypad
      4. 24.4.4. Class CashDispenser
      5. 24.4.5. Class DepositSlot
      6. 24.4.6. Class Account
      7. 24.4.7. Class BankDatabase
      8. 24.4.8. Class Transaction
      9. 24.4.9. Class BalanceInquiry
      10. 24.4.10. Class Withdrawal
      11. 24.4.11. Class Deposit
      12. 24.4.12. Class ATMCaseStudy
    5. 24.5. Wrap-Up
      1. Answers to Self-Review Exercises
  34. A. Operator Precedence Chart
  35. B. ASCII Character Set
  36. C. Keywords and Reserved Words
  37. D. Primitive Types
  38. E. Using the Debugger
    1. E.1. Introduction
    2. E.2. Breakpoints and the run, stop, cont and print Commands
    3. E.3. The print and set Commands
    4. E.4. Controlling Execution Using the step, step up and next Commands
    5. E.5. The watch Command
    6. E.6. The clear Command
    7. E.7. Wrap-Up
  39. F. Using the Java API Documentation
    1. F.1. Introduction
    2. F.2. Navigating the Java API
      1. Frames in the API Documentation’s index.html Page
      2. Important Links in the index.html Page
      3. Viewing the Index Page
      4. Viewing a Specific Package
      5. Viewing the Details of a Class
      6. Summary Sections in a Class’s Documentation Page
      7. Detail Sections in a Class’s Documentation Page
  40. G. Creating Documentation with javadoc
    1. G.1. Introduction
    2. G.2. Documentation Comments
    3. G.3. Documenting Java Source Code
    4. G.4. javadoc
      1. Downloading the Java Documentation
      2. Executing javadoc from the Command Line
    5. G.5. Files Produced by javadoc
  41. H. Unicode®
    1. H.1. Introduction
    2. H.2. Unicode Transformation Formats
    3. H.3. Characters and Glyphs
    4. H.4. Advantages/Disadvantages of Unicode
    5. H.5. Using Unicode
    6. H.6. Character Ranges
  42. I. Formatted Output
    1. I.1. Introduction
    2. I.2. Streams
    3. I.3. Formatting Output with printf
    4. I.4. Printing Integers
    5. I.5. Printing Floating-Point Numbers
    6. I.6. Printing Strings and Characters
    7. I.7. Printing Dates and Times
    8. I.8. Other Conversion Characters
    9. I.9. Printing with Field Widths and Precisions
    10. I.10. Using Flags in the printf Format String
    11. I.11. Printing with Argument Indices
    12. I.12. Printing Literals and Escape Sequences
    13. I.13. Formatting Output with Class Formatter
    14. I.14. Wrap-Up
  43. J. Number Systems
    1. J.1. Introduction
    2. J.2. Abbreviating Binary Numbers as Octal and Hexadecimal Numbers
    3. J.3. Converting Octal and Hexadecimal Numbers to Binary Numbers
    4. J.4. Converting from Binary, Octal or Hexadecimal to Decimal
    5. J.5. Converting from Decimal to Binary, Octal or Hexadecimal
    6. J.6. Negative Binary Numbers: Two’s Complement Notation
  44. K. Bit Manipulation
    1. K.1. Introduction
    2. K.2. Bit Manipulation and the Bitwise Operators
    3. K.3. BitSet Class
  45. L. Labeled break and continue Statements
    1. L.1. Introduction
    2. L.2. Labeled break Statement
    3. L.3. Labeled continue Statement
  46. M. UML 2: Additional Diagram Types
    1. M.1. Introduction
    2. M.2. Additional Diagram Types
  47. N. Design Patterns
    1. N.1. Introduction
      1. History of Object-Oriented Design Patterns
    2. N.2. Creational, Structural and Behavioral Design Patterns
      1. N.2.1. Creational Design Patterns
      2. N.2.2. Structural Design Patterns
      3. N.2.3. Behavioral Design Patterns
      4. N.2.4. Conclusion
    3. N.3. Design Patterns in Packages java.awt and javax.swing
      1. N.3.1. Creational Design Patterns
      2. N.3.2. Structural Design Patterns
      3. N.3.3. Behavioral Design Patterns
      4. N.3.4. Conclusion
    4. N.4. Concurrency Design Patterns
      1. Concurrency Design Patterns
    5. N.5. Design Patterns Used in Packages java.io and java.net
      1. N.5.1. Creational Design Patterns
      2. N.5.2. Structural Design Patterns
      3. N.5.3. Architectural Patterns
      4. N.5.4. Conclusion
    6. N.6. Design Patterns Used in Package java.util
      1. N.6.1. Creational Design Patterns
      2. N.6.2. Behavioral Design Patterns
    7. N.7. Wrap-Up
  48. Index
  49. Comments from Recent Editions Reviewers