Java: The Complete Reference, Thirteenth Edition, 13th Edition

Book description

The definitive guide to Java programming—thoroughly revised for Java SE 21

Fully updated for the current version of Java, Java SE 21, this comprehensive guide shows, step by step, how to design, write, debug, run, and administer high-performance Java programs. Inside, bestselling author Herbert Schildt and programming expert Dr. Danny Coward cover the entire Java language, including its syntax, keywords, and libraries. The book lays out cutting-edge development techniques and best practices.

Java: The Complete Reference, Thirteenth Edition features clear explanations, detailed code samples, and real-world examples that demonstrate how Java can be put to work in the real world. JavaBeans, servlets, applets, Swing, lambda expressions, multithreading, and the default interface method are thoroughly discussed. You will get full details on all of the latest features and changes in JDK 18 through long-term support (LTS) release JDK 21.

  • Designed for novice, intermediate, and professional programmers alike
  • Source code for all examples and projects are available for download
  • Written in the clear, uncompromising style Herb Schildt is famous for

Table of contents

  1. Cover
  2. Title Page
  3. Copyright Page
  4. Contents at a Glance
  5. Contents
  6. Foreword
  7. Preface
  8. Part I The Java Language
    1. Chapter 1 The History and Evolution of Java
      1. Java’s Lineage
        1. The Birth of Modern Programming: C
        2. C++: The Next Step
        3. The Stage Is Set for Java
      2. The Creation of Java
        1. The C# Connection
        2. Longevity
      3. How Java Impacted the Internet
        1. Java Applets
        2. Security
        3. Portability
      4. Java’s Magic: The Bytecode
      5. Moving Beyond Applets
      6. A Faster Release Schedule
      7. Servlets: Java on the Server Side
      8. The Java Buzzwords
        1. Simple
        2. Object-Oriented
        3. Robust
        4. Multithreaded
        5. Architecture-Neutral
        6. Interpreted and High Performance
        7. Distributed
        8. Dynamic
      9. The Evolution of Java
      10. A Culture of Innovation
    2. Chapter 2 An Overview of Java
      1. Object-Oriented Programming
        1. Two Paradigms
        2. Abstraction
        3. The Three OOP Principles
      2. A First Simple Program
        1. Entering the Program
        2. Compiling the Program
        3. A Closer Look at the First Sample Program
      3. A Second Short Program
      4. Two Control Statements
        1. The if Statement
        2. The for Loop
      5. Using Blocks of Code
      6. Lexical Issues
        1. Whitespace
        2. Identifiers
        3. Literals
        4. Comments
        5. Separators
        6. The Java Keywords
      7. The Java Class Libraries
    3. Chapter 3 Data Types, Variables, and Arrays
      1. Java Is a Strongly Typed Language
      2. The Primitive Types
      3. Integers
        1. byte
        2. short
        3. int
        4. long
      4. Floating-Point Types
        1. float
        2. double
      5. Characters
      6. Booleans
      7. A Closer Look at Literals
        1. Integer Literals
        2. Floating-Point Literals
        3. Boolean Literals
        4. Character Literals
        5. String Literals
      8. Variables
        1. Declaring a Variable
        2. Dynamic Initialization
        3. The Scope and Lifetime of Variables
      9. Type Conversion and Casting
        1. Java’s Automatic Conversions
        2. Casting Incompatible Types
      10. Automatic Type Promotion in Expressions
        1. The Type Promotion Rules
      11. Arrays
        1. One-Dimensional Arrays
        2. Multidimensional Arrays
        3. Alternative Array Declaration Syntax
      12. Introducing Type Inference with Local Variables
        1. Some var Restrictions
      13. A Few Words About Strings
    4. Chapter 4 Operators
      1. Arithmetic Operators
        1. The Basic Arithmetic Operators
        2. The Modulus Operator
        3. Arithmetic Compound Assignment Operators
        4. Increment and Decrement
      2. The Bitwise Operators
        1. The Bitwise Logical Operators
        2. The Left Shift
        3. The Right Shift
        4. The Unsigned Right Shift
        5. Bitwise Operator Compound Assignments
      3. Relational Operators
      4. Boolean Logical Operators
        1. Short-Circuit Logical Operators
      5. The Assignment Operator
      6. The ? Operator
      7. Operator Precedence
      8. Using Parentheses
    5. Chapter 5 Control Statements
      1. Java’s Selection Statements
        1. if
        2. The Traditional switch
      2. Iteration Statements
        1. while
        2. do-while
        3. for
        4. The For-Each Version of the for Loop
        5. Local Variable Type Inference in a for Loop
        6. Nested Loops
      3. Jump Statements
        1. Using break
        2. Using continue
        3. return
    6. Chapter 6 Introducing Classes
      1. Class Fundamentals
        1. The General Form of a Class
        2. A Simple Class
      2. Declaring Objects
        1. A Closer Look at new
      3. Assigning Object Reference Variables
      4. Introducing Methods
        1. Adding a Method to the Box Class
        2. Returning a Value
        3. Adding a Method That Takes Parameters
      5. Constructors
        1. Parameterized Constructors
      6. The this Keyword
        1. Instance Variable Hiding
      7. Garbage Collection
      8. A Stack Class
    7. Chapter 7 A Closer Look at Methods and Classes
      1. Overloading Methods
        1. Overloading Constructors
      2. Using Objects as Parameters
      3. A Closer Look at Argument Passing
      4. Returning Objects
      5. Recursion
      6. Introducing Access Control
      7. Understanding static
      8. Introducing final
      9. Arrays Revisited
      10. Introducing Nested and Inner Classes
      11. Exploring the String Class
      12. Using Command-Line Arguments
      13. Varargs: Variable-Length Arguments
        1. Overloading Vararg Methods
        2. Varargs and Ambiguity
      14. Local Variable Type Inference with Reference Types
    8. Chapter 8 Inheritance
      1. Inheritance Basics
        1. Member Access and Inheritance
        2. A More Practical Example
        3. A Superclass Variable Can Reference a Subclass Object
      2. Using super
        1. Using super to Call Superclass Constructors
        2. A Second Use for super
      3. Creating a Multilevel Hierarchy
      4. When Constructors Are Executed
      5. Method Overriding
      6. Dynamic Method Dispatch
        1. Why Overridden Methods?
        2. Applying Method Overriding
      7. Using Abstract Classes
      8. Using final with Inheritance
        1. Using final to Prevent Overriding
        2. Using final to Prevent Inheritance
      9. Local Variable Type Inference and Inheritance
      10. The Object Class
    9. Chapter 9 Packages and Interfaces
      1. Packages
        1. Defining a Package
        2. Finding Packages and CLASSPATH
        3. A Short Package Example
      2. Packages and Member Access
        1. An Access Example
      3. Importing Packages
      4. Interfaces
        1. Defining an Interface
        2. Implementing Interfaces
        3. Nested Interfaces
        4. Applying Interfaces
        5. Variables in Interfaces
        6. Interfaces Can Be Extended
      5. Default Interface Methods
        1. Default Method Fundamentals
        2. A More Practical Example
        3. Multiple Inheritance Issues
      6. Use static Methods in an Interface
      7. Private Interface Methods
      8. Final Thoughts on Packages and Interfaces
    10. Chapter 10 Exception Handling
      1. Exception-Handling Fundamentals
      2. Exception Types
      3. Uncaught Exceptions
      4. Using try and catch
        1. Displaying a Description of an Exception
      5. Multiple catch Clauses
      6. Nested try Statements
      7. throw
      8. throws
      9. finally
      10. Java’s Built-in Exceptions
      11. Creating Your Own Exception Subclasses
      12. Chained Exceptions
      13. Three Additional Exception Features
      14. Using Exceptions
    11. Chapter 11 Multithreaded Programming
      1. The Java Thread Model
        1. Thread Priorities
        2. Synchronization
        3. Messaging
        4. The Thread Class and the Runnable Interface
      2. The Main Thread
      3. Creating a Thread
        1. Implementing Runnable
        2. Extending Thread
        3. Choosing an Approach
      4. Creating Multiple Threads
      5. Using isAlive( ) and join( )
      6. Thread Priorities
      7. Synchronization
        1. Using Synchronized Methods
        2. The synchronized Statement
      8. Interthread Communication
        1. Deadlock
      9. Suspending, Resuming, and Stopping Threads
      10. Obtaining a Thread’s State
      11. Using a Factory Method to Create and Start a Thread
      12. Virtual Threads
      13. Using Multithreading
    12. Chapter 12 Enumerations, Autoboxing, and Annotations
      1. Enumerations
        1. Enumeration Fundamentals
        2. The values( ) and valueOf( ) Methods
        3. Java Enumerations Are Class Types
        4. Enumerations Inherit Enum
        5. Another Enumeration Example
      2. Type Wrappers
        1. Character
        2. Boolean
        3. The Numeric Type Wrappers
      3. Autoboxing
        1. Autoboxing and Methods
        2. Autoboxing/Unboxing Occurs in Expressions
        3. Autoboxing/Unboxing Boolean and Character Values
        4. Autoboxing/Unboxing Helps Prevent Errors
        5. A Word of Warning
      4. Annotations
        1. Annotation Basics
        2. Specifying a Retention Policy
        3. Obtaining Annotations at Run Time by Use of Reflection
        4. The AnnotatedElement Interface
        5. Using Default Values
        6. Marker Annotations
        7. Single-Member Annotations
        8. The Built-In Annotations
      5. Type Annotations
      6. Repeating Annotations
      7. Some Restrictions
    13. Chapter 13 I/O, Try-with-Resources, and Other Topics
      1. I/O Basics
        1. Streams
        2. Byte Streams and Character Streams
        3. The Predefined Streams
      2. Reading Console Input
        1. Reading Characters
        2. Reading Strings
      3. Writing Console Output
      4. The PrintWriter Class
      5. Reading and Writing Files
      6. Automatically Closing a File
      7. The transient and volatile Modifiers
      8. Introducing instanceof
      9. strictfp
      10. Native Methods
      11. Using assert
        1. Assertion Enabling and Disabling Options
      12. Static Import
      13. Invoking Overloaded Constructors Through this( )
      14. A Word About Value-Based Classes
    14. Chapter 14 Generics
      1. What Are Generics?
      2. A Simple Generics Example
        1. Generics Work Only with Reference Types
        2. Generic Types Differ Based on Their Type Arguments
        3. How Generics Improve Type Safety
      3. A Generic Class with Two Type Parameters
      4. The General Form of a Generic Class
      5. Bounded Types
      6. Using Wildcard Arguments
        1. Bounded Wildcards
      7. Creating a Generic Method
        1. Generic Constructors
      8. Generic Interfaces
      9. Raw Types and Legacy Code
      10. Generic Class Hierarchies
        1. Using a Generic Superclass
        2. A Generic Subclass
        3. Run-Time Type Comparisons Within a Generic Hierarchy
        4. Casting
        5. Overriding Methods in a Generic Class
      11. Type Inference with Generics
      12. Local Variable Type Inference and Generics
      13. Erasure
        1. Bridge Methods
      14. Ambiguity Errors
      15. Some Generic Restrictions
        1. Type Parameters Can’t Be Instantiated
        2. Restrictions on Static Members
        3. Generic Array Restrictions
        4. Generic Exception Restriction
    15. Chapter 15 Lambda Expressions
      1. Introducing Lambda Expressions
        1. Lambda Expression Fundamentals
        2. Functional Interfaces
        3. Some Lambda Expression Examples
      2. Block Lambda Expressions
      3. Generic Functional Interfaces
      4. Passing Lambda Expressions as Arguments
      5. Lambda Expressions and Exceptions
      6. Lambda Expressions and Variable Capture
      7. Method References
        1. Method References to static Methods
        2. Method References to Instance Methods
        3. Method References with Generics
      8. Constructor References
      9. Predefined Functional Interfaces
    16. Chapter 16 Modules
      1. Module Basics
        1. A Simple Module Example
        2. Compile and Run the First Module Example
        3. A Closer Look at requires and exports
      2. java.base and the Platform Modules
      3. Legacy Code and the Unnamed Module
      4. Exporting to a Specific Module
      5. Using requires transitive
      6. Use Services
        1. Service and Service Provider Basics
        2. The Service-Based Keywords
        3. A Module-Based Service Example
      7. Module Graphs
      8. Three Specialized Module Features
        1. Open Modules
        2. The opens Statement
        3. requires static
      9. Introducing jlink and Module JAR Files
        1. Linking Files in an Exploded Directory
        2. Linking Modular JAR Files
        3. JMOD Files
      10. A Brief Word About Layers and Automatic Modules
      11. Final Thoughts on Modules
    17. Chapter 17 Switch Expressions, Records, and Other Recently Added Features
      1. Records
        1. Record Basics
        2. Create Record Constructors
        3. Another Record Constructor Example
        4. Create Record Getter Methods
      2. Pattern Matching with instanceof
        1. Pattern Variables in a Logical AND Expression
        2. Pattern Matching in Other Statements
      3. Enhancements to switch
        1. Use a List of case Constants
        2. Introducing the switch Expression and the yield Statement
        3. Introducing the Arrow in a case Statement
        4. A Closer Look at the Arrow case
        5. Another switch Expression Example
        6. Pattern Matching in switch
      4. Text Blocks
        1. Text Block Fundamentals
        2. Understanding Leading Whitespace
        3. Use Double Quotes in a Text Block
        4. Escape Sequences in Text Blocks
        5. Pattern Matching with Records
      5. Sealed Classes and Interfaces
        1. Sealed Classes
        2. Sealed Interfaces
      6. Future Directions
  9. Part II The Java Library
    1. Chapter 18 String Handling
      1. The String Constructors
      2. String Length
      3. Special String Operations
        1. String Literals
        2. String Concatenation
        3. String Concatenation with Other Data Types
        4. String Conversion and toString( )
      4. Character Extraction
        1. charAt( )
        2. getChars( )
        3. getBytes( )
        4. toCharArray( )
      5. String Comparison
        1. equals( ) and equalsIgnoreCase( )
        2. regionMatches( )
        3. startsWith( ) and endsWith( )
        4. equals( ) Versus ==
        5. compareTo( )
      6. Searching Strings
      7. Modifying a String
        1. substring( )
        2. concat( )
        3. replace( )
        4. trim( ) and strip( )
      8. Data Conversion Using valueOf( )
      9. Changing the Case of Characters Within a String
      10. Joining Strings
      11. Additional String Methods
      12. StringBuffer
        1. StringBuffer Constructors
        2. length( ) and capacity( )
        3. ensureCapacity( )
        4. setLength( )
        5. charAt( ) and setCharAt( )
        6. getChars( )
        7. append( )
        8. insert( )
        9. reverse( )
        10. delete( ) and deleteCharAt( )
        11. replace( )
        12. substring( )
        13. Additional StringBuffer Methods
      13. StringBuilder
    2. Chapter 19 Exploring java.lang
      1. Primitive Type Wrappers
        1. Number
        2. Double and Float
        3. Understanding isInfinite( ) and isNaN( )
        4. Byte, Short, Integer, and Long
        5. Character
        6. Additions to Character for Unicode Code Point Support
        7. Boolean
      2. Void
      3. Process
      4. Runtime
        1. Executing Other Programs
      5. Runtime.Version
      6. ProcessBuilder
      7. System
        1. Using currentTimeMillis( ) to Time Program Execution
        2. Using arraycopy( )
        3. Environment Properties
      8. System.Logger and System.LoggerFinder
      9. Object
      10. Using clone( ) and the Cloneable Interface
      11. Class
      12. ClassLoader
      13. Math
        1. Trigonometric Functions
        2. Exponential Functions
        3. Rounding Functions
        4. Miscellaneous Math Methods
      14. StrictMath
      15. Compiler
      16. Thread, ThreadGroup, and Runnable
        1. The Runnable Interface
        2. Thread
        3. ThreadGroup
      17. ThreadLocal and InheritableThreadLocal
      18. Package
      19. Module
      20. ModuleLayer
      21. RuntimePermission
      22. Throwable
      23. SecurityManager
      24. StackTraceElement
      25. StackWalker and StackWalker.StackFrame
      26. Enum
      27. Record
      28. ClassValue
      29. The CharSequence Interface
      30. The Comparable Interface
      31. The Appendable Interface
      32. The Iterable Interface
      33. The Readable Interface
      34. The AutoCloseable Interface
      35. The Thread.UncaughtExceptionHandler Interface
      36. The java.lang Subpackages
        1. java.lang.annotation
        2. java.lang.constant
        3. java.lang.instrument
        4. java.lang.invoke
        5. java.lang.management
        6. java.lang.module
        7. java.lang.ref
        8. java.lang.reflect
    3. Chapter 20 java.util Part 1: The Collections Framework
      1. Collections Overview
      2. The Collection Interfaces
        1. The Collection Interface
        2. The SequencedCollection Interface
        3. The List Interface
        4. The Set Interface
        5. The SequencedSet Interface
        6. The SortedSet Interface
        7. The NavigableSet Interface
        8. The Queue Interface
        9. The Deque Interface
      3. The Collection Classes
        1. The ArrayList Class
        2. The LinkedList Class
        3. The HashSet Class
        4. The LinkedHashSet Class
        5. The TreeSet Class
        6. The PriorityQueue Class
        7. The ArrayDeque Class
        8. The EnumSet Class
      4. Accessing a Collection via an Iterator
        1. Using an Iterator
        2. The For-Each Alternative to Iterators
      5. Spliterators
      6. Storing User-Defined Classes in Collections
      7. The RandomAccess Interface
      8. Working with Maps
        1. The Map Interfaces
        2. The Map Classes
      9. Comparators
        1. Using a Comparator
      10. The Collection Algorithms
      11. Arrays
      12. The Legacy Classes and Interfaces
        1. The Enumeration Interface
        2. Vector
        3. Stack
        4. Dictionary
        5. Hashtable
        6. Properties
        7. Using store( ) and load( )
      13. Parting Thoughts on Collections
    4. Chapter 21 java.util Part 2: More Utility Classes
      1. StringTokenizer
      2. BitSet
      3. Optional, OptionalDouble, OptionalInt, and OptionalLong
      4. Date
      5. Calendar
      6. GregorianCalendar
      7. TimeZone
      8. SimpleTimeZone
      9. Locale
      10. Random
      11. Timer and TimerTask
      12. Currency
      13. Formatter
        1. The Formatter Constructors
        2. The Formatter Methods
        3. Formatting Basics
        4. Formatting Strings and Characters
        5. Formatting Numbers
        6. Formatting Time and Date
        7. The %n and %% Specifiers
        8. Specifying a Minimum Field Width
        9. Specifying Precision
        10. Using the Format Flags
        11. Justifying Output
        12. The Space, +, 0, and ( Flags
        13. The Comma Flag
        14. The # Flag
        15. The Uppercase Option
        16. Using an Argument Index
        17. Closing a Formatter
        18. The Java printf( ) Connection
      14. Scanner
        1. The Scanner Constructors
        2. Scanning Basics
        3. Some Scanner Examples
        4. Setting Delimiters
        5. Other Scanner Features
      15. The ResourceBundle, ListResourceBundle, and PropertyResourceBundle Classes
      16. Miscellaneous Utility Classes and Interfaces
      17. The java.util Subpackages
        1. java.util.concurrent, java.util.concurrent.atomic, and java.util.concurrent.locks
        2. java.util.function
        3. java.util.jar
        4. java.util.logging
        5. java.util.prefs
        6. java.util.random
        7. java.util.regex
        8. java.util.spi
        9. java.util.stream
        10. java.util.zip
    5. Chapter 22 Input/Output: Exploring java.io
      1. The I/O Classes and Interfaces
      2. File
        1. Directories
        2. Using FilenameFilter
        3. The listFiles( ) Alternative
        4. Creating Directories
      3. The AutoCloseable, Closeable, and Flushable Interfaces
      4. I/O Exceptions
      5. Two Ways to Close a Stream
      6. The Stream Classes
      7. The Byte Streams
        1. InputStream
        2. OutputStream
        3. FileInputStream
        4. FileOutputStream
        5. ByteArrayInputStream
        6. ByteArrayOutputStream
        7. Filtered Byte Streams
        8. Buffered Byte Streams
        9. SequenceInputStream
        10. PrintStream
        11. DataOutputStream and DataInputStream
        12. RandomAccessFile
      8. The Character Streams
        1. Reader
        2. Writer
        3. FileReader
        4. FileWriter
        5. CharArrayReader
        6. CharArrayWriter
        7. BufferedReader
        8. BufferedWriter
        9. PushbackReader
        10. PrintWriter
      9. The Console Class
      10. Serialization
        1. Serializable
        2. Externalizable
        3. ObjectOutput
        4. ObjectOutputStream
        5. ObjectInput
        6. ObjectInputStream
        7. A Serialization Example
      11. Stream Benefits
    6. Chapter 23 Exploring NIO
      1. The NIO Classes
      2. NIO Fundamentals
        1. Buffers
        2. Channels
        3. Charsets and Selectors
      3. Enhancements Added by NIO.2
        1. The Path Interface
        2. The Files Class
        3. The Paths Class
        4. The File Attribute Interfaces
        5. The FileSystem, FileSystems, and FileStore Classes
      4. Using the NIO System
        1. Use NIO for Channel-Based I/O
        2. Use NIO for Stream-Based I/O
        3. Use NIO for Path and File System Operations
    7. Chapter 24 Networking
      1. Networking Basics
      2. The java.net Networking Classes and Interfaces
      3. InetAddress
        1. Factory Methods
        2. Instance Methods
      4. Inet4Address and Inet6Address
      5. TCP/IP Client Sockets
      6. URL
      7. URLConnection
      8. HttpURLConnection
      9. The URI Class
      10. Cookies
      11. TCP/IP Server Sockets
      12. Datagrams
        1. DatagramSocket
        2. DatagramPacket
        3. A Datagram Example
      13. Introducing java.net.http
        1. Three Key Elements
        2. A Simple HTTP Client Example
        3. Things to Explore in java.net.http
    8. Chapter 25 Event Handling
      1. Two Event Handling Mechanisms
      2. The Delegation Event Model
        1. Events
        2. Event Sources
        3. Event Listeners
      3. Event Classes
        1. The ActionEvent Class
        2. The AdjustmentEvent Class
        3. The ComponentEvent Class
        4. The ContainerEvent Class
        5. The FocusEvent Class
        6. The InputEvent Class
        7. The ItemEvent Class
      4. The KeyEvent Class
        1. The MouseEvent Class
        2. The MouseWheelEvent Class
        3. The TextEvent Class
        4. The WindowEvent Class
      5. Sources of Events
      6. Event Listener Interfaces
        1. The ActionListener Interface
        2. The AdjustmentListener Interface
        3. The ComponentListener Interface
        4. The ContainerListener Interface
        5. The FocusListener Interface
        6. The ItemListener Interface
        7. The KeyListener Interface
        8. The MouseListener Interface
        9. The MouseMotionListener Interface
        10. The MouseWheelListener Interface
        11. The TextListener Interface
        12. The WindowFocusListener Interface
        13. The WindowListener Interface
      7. Using the Delegation Event Model
        1. Some Key AWT GUI Concepts
        2. Handling Mouse Events
        3. Handling Keyboard Events
      8. Adapter Classes
      9. Inner Classes
        1. Anonymous Inner Classes
    9. Chapter 26 Introducing the AWT: Working with Windows, Graphics, and Text
      1. AWT Classes
      2. Window Fundamentals
        1. Component
        2. Container
        3. Panel
        4. Window
        5. Frame
        6. Canvas
      3. Working with Frame Windows
        1. Setting the Window’s Dimensions
        2. Hiding and Showing a Window
        3. Setting a Window’s Title
        4. Closing a Frame Window
        5. The paint( ) Method
        6. Displaying a String
        7. Setting the Foreground and Background Colors
        8. Requesting Repainting
        9. Creating a Frame-Based Application
      4. Introducing Graphics
        1. Drawing Lines
        2. Drawing Rectangles
        3. Drawing Ellipses and Circles
        4. Drawing Arcs
        5. Drawing Polygons
        6. Demonstrating the Drawing Methods
        7. Sizing Graphics
      5. Working with Color
        1. Color Methods
        2. Setting the Current Graphics Color
        3. A Color Demonstration Program
      6. Setting the Paint Mode
      7. Working with Fonts
        1. Determining the Available Fonts
        2. Creating and Selecting a Font
        3. Obtaining Font Information
      8. Managing Text Output Using FontMetrics
    10. Chapter 27 Using AWT Controls, Layout Managers, and Menus
      1. AWT Control Fundamentals
        1. Adding and Removing Controls
        2. Responding to Controls
        3. The HeadlessException
      2. Labels
      3. Using Buttons
        1. Handling Buttons
      4. Applying Check Boxes
        1. Handling Check Boxes
      5. CheckboxGroup
      6. Choice Controls
        1. Handling Choice Lists
      7. Using Lists
        1. Handling Lists
      8. Managing Scroll Bars
        1. Handling Scroll Bars
      9. Using a TextField
        1. Handling a TextField
      10. Using a TextArea
      11. Understanding Layout Managers
        1. FlowLayout
        2. BorderLayout
        3. Using Insets
        4. GridLayout
        5. CardLayout
        6. GridBagLayout
      12. Menu Bars and Menus
      13. Dialog Boxes
      14. A Word About Overriding paint( )
    11. Chapter 28 Images
      1. File Formats
      2. Image Fundamentals: Creating, Loading, and Displaying
        1. Creating an Image Object
        2. Loading an Image
        3. Displaying an Image
      3. Double Buffering
      4. ImageProducer
        1. MemoryImageSource
      5. ImageConsumer
        1. PixelGrabber
      6. ImageFilter
        1. CropImageFilter
        2. RGBImageFilter
      7. Additional Imaging Classes
    12. Chapter 29 The Concurrency Utilities
      1. The Concurrent API Packages
        1. java.util.concurrent
        2. java.util.concurrent.atomic
        3. java.util.concurrent.locks
      2. Using Synchronization Objects
        1. Semaphore
        2. CountDownLatch
        3. CyclicBarrier
        4. Exchanger
        5. Phaser
      3. Using an Executor
        1. A Simple Executor Example
        2. Using Callable and Future
      4. The TimeUnit Enumeration
      5. The Concurrent Collections
      6. Locks
      7. Atomic Operations
      8. Parallel Programming via the Fork/Join Framework
        1. The Main Fork/Join Classes
        2. The Divide-and-Conquer Strategy
        3. A Simple First Fork/Join Example
        4. Understanding the Impact of the Level of Parallelism
        5. An Example that Uses RecursiveTask<V>
        6. Executing a Task Asynchronously
        7. Cancelling a Task
        8. Determining a Task’s Completion Status
        9. Restarting a Task
        10. Things to Explore
        11. Some Fork/Join Tips
      9. The Concurrency Utilities Versus Java’s Traditional Approach
    13. Chapter 30 The Stream API
      1. Stream Basics
        1. Stream Interfaces
        2. How to Obtain a Stream
        3. A Simple Stream Example
      2. Reduction Operations
      3. Using Parallel Streams
      4. Mapping
      5. Collecting
      6. Iterators and Streams
        1. Use an Iterator with a Stream
        2. Use Spliterator
      7. More to Explore in the Stream API
    14. Chapter 31 Regular Expressions and Other Packages
      1. Regular Expression Processing
        1. Pattern
        2. Matcher
        3. Regular Expression Syntax
        4. Demonstrating Pattern Matching
        5. Two Pattern-Matching Options
        6. Exploring Regular Expressions
      2. Reflection
      3. Remote Method Invocation
        1. A Simple Client/Server Application Using RMI
      4. Formatting Date and Time with java.text
        1. DateFormat Class
        2. SimpleDateFormat Class
      5. The java.time Time and Date API
        1. Time and Date Fundamentals
        2. Formatting Date and Time
        3. Parsing Date and Time Strings
        4. Other Things to Explore in java.time
  10. Part III Introducing GUI Programming with Swing
    1. Chapter 32 Introducing Swing
      1. The Origins of Swing
      2. Swing Is Built on the AWT
      3. Two Key Swing Features
        1. Swing Components Are Lightweight
        2. Swing Supports a Pluggable Look and Feel
      4. The MVC Connection
      5. Components and Containers
        1. Components
        2. Containers
        3. The Top-Level Container Panes
      6. The Swing Packages
      7. A Simple Swing Application
      8. Event Handling
      9. Painting in Swing
        1. Painting Fundamentals
        2. Compute the Paintable Area
        3. A Paint Example
    2. Chapter 33 Exploring Swing
      1. JLabel and ImageIcon
      2. JTextField
      3. The Swing Buttons
        1. JButton
        2. JToggleButton
        3. Check Boxes
        4. Radio Buttons
      4. JTabbedPane
      5. JScrollPane
      6. JList
      7. JComboBox
      8. Trees
      9. JTable
    3. Chapter 34 Introducing Swing Menus
      1. Menu Basics
      2. An Overview of JMenuBar, JMenu, and JMenuItem
        1. JMenuBar
        2. JMenu
        3. JMenuItem
      3. Create a Main Menu
      4. Add Mnemonics and Accelerators to Menu Items
      5. Add Images and Tooltips to Menu Items
      6. Use JRadioButtonMenuItem and JCheckBoxMenuItem
      7. Create a Popup Menu
      8. Create a Toolbar
      9. Use Actions
      10. Put the Entire MenuDemo Program Together
      11. Continuing Your Exploration of Swing
  11. Part IV Applying Java
    1. Chapter 35 Java Beans
      1. What Is a Java Bean?
      2. Advantages of Beans
      3. Introspection
        1. Design Patterns for Properties
        2. Design Patterns for Events
        3. Methods and Design Patterns
        4. Using the BeanInfo Interface
      4. Bound and Constrained Properties
      5. Persistence
      6. Customizers
      7. The JavaBeans API
        1. Introspector
        2. PropertyDescriptor
        3. EventSetDescriptor
        4. MethodDescriptor
      8. A Bean Example
    2. Chapter 36 Introducing Servlets
      1. Background
      2. The Life Cycle of a Servlet
      3. Servlet Development Options
      4. Using Tomcat
      5. A Simple Servlet
        1. Create and Compile the Servlet Source Code
        2. Start Tomcat
        3. Start a Web Browser and Request the Servlet
      6. The Servlet API
      7. The jakarta.servlet Package
        1. The Servlet Interface
        2. The ServletConfig Interface
        3. The ServletContext Interface
        4. The ServletRequest Interface
        5. The ServletResponse Interface
        6. The GenericServlet Class
        7. The ServletInputStream Class
        8. The ServletOutputStream Class
        9. The Servlet Exception Classes
      8. Reading Servlet Parameters
      9. The jakarta.servlet.http Package
        1. The HttpServletRequest Interface
        2. The HttpServletResponse Interface
        3. The HttpSession Interface
        4. The Cookie Class
        5. The HttpServlet Class
      10. Handling HTTP Requests and Responses
        1. Handling HTTP GET Requests
        2. Handling HTTP POST Requests
      11. Using Cookies
      12. Session Tracking
  12. Part V Appendixes
    1. Appendix A Using Java’s Documentation Comments
      1. The javadoc Tags
        1. @author
        2. {@code}
        3. @deprecated
        4. {@docRoot}
        5. @end
        6. @exception
        7. @hidden
        8. {@index}
        9. {@inheritDoc}
        10. {@link}
        11. {@linkplain}
        12. {@literal}
        13. @param
        14. @provides
        15. @return
        16. @see
        17. @serial
        18. @serialData
        19. @serialField
        20. @since
        21. {@snippet}
        22. @start
        23. {@summary}
        24. {@systemProperty}
        25. @throws
        26. @uses
        27. {@value}
        28. @version
      2. The General Form of a Documentation Comment
      3. What javadoc Outputs
      4. An Example that Uses Documentation Comments
    2. Appendix B Introducing JShell
      1. JShell Basics
      2. List, Edit, and Rerun Code
      3. Add a Method
      4. Create a Class
      5. Use an Interface
      6. Evaluate Expressions and Use Built-in Variables
      7. Importing Packages
      8. Exceptions
      9. Some More JShell Commands
      10. Exploring JShell Further
    3. Appendix C Compile and Run Simple Single-File Programs in One Step
  13. Index

Product information

  • Title: Java: The Complete Reference, Thirteenth Edition, 13th Edition
  • Author(s): Herbert Schildt, Dr. Danny Coward
  • Release date: January 2024
  • Publisher(s): McGraw-Hill
  • ISBN: 9781265062705