Java: The Complete Reference, Ninth Edition, 9th Edition

Book description

The Definitive Java Programming Guide

Fully updated for Java SE 8, Java: The Complete Reference, Ninth Edition explains how to develop, compile, debug, and run Java programs. Bestselling programming author Herb Schildt covers the entire Java language, including its syntax, keywords, and fundamental programming principles, as well as significant portions of the Java API library. JavaBeans, servlets, applets, and Swing are examined and real-world examples demonstrate Java in action. New Java SE 8 features such as lambda expressions, the stream library, and the default interface method are discussed in detail. This Oracle Press resource also offers a solid introduction to JavaFX.

Coverage includes:

  • Data types, variables, arrays, and operators
  • Control statements
  • Classes, objects, and methods
  • Method overloading and overriding
  • Inheritance
  • Interfaces and packages
  • Exception handling
  • Multithreaded programming
  • Enumerations, autoboxing, and annotations
  • The I/O classes
  • Generics
  • Lambda expressions
  • String handling
  • The Collections Framework
  • Networking
  • Event handling
  • AWT and Swing
  • The Concurrent API
  • The Stream API
  • Regular expressions
  • JavaFX
  • JavaBeans
  • Applets and servlets
  • Much, much more

Table of contents

  1. Cover 
  2. About the Author
    1. About the Technical Editor
  3. Title Page
  4. Copyright Page
  5. Contents at a Glance
  6. Contents 
  7. Preface
    1. A Book for All Programmers
    2. What’s Inside
    3. Don’t Forget: Code on the Web
    4. Special Thanks
    5. For Further Study
  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
      3. How Java Changed the Internet
        1. Java Applets
        2. Security
        3. Portability
      4. Java’s Magic: The Bytecode
      5. Servlets: Java on the Server Side
      6. The Java Buzzwords
        1. Simple
        2. Object-Oriented
        3. Robust
        4. Multithreaded
        5. Architecture-Neutral
        6. Interpreted and High Performance
        7. Distributed
        8. Dynamic
      7. The Evolution of Java
      8. Java SE 8
      9. 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. A Few Words About Strings
      13. A Note to C/C++ Programmers About Pointers
    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. switch
      2. Iteration Statements
        1. while
        2. do-while
        3. for
        4. The For-Each Version of the for Loop
        5. Nested Loops
      3. Jump Statements
        1. Using break
        2. Using continue
    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. The finalize( ) Method
      9. 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
    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. 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. Access Protection
        1. An Access Example
      3. Importing Packages
      4. Interfaces
        1. Defining an Inter face
        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. 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 Recently Added 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 Multithreading
    12. Chapter 12: Enumerations, Autoboxing, and Annotations (Metadata)
      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 (Metadata)
        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
        1. Some Restrictions
    13. Chapter 13: I/O, Applets, 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. Applet Fundamentals
      8. The transient and volatile Modifiers
      9. Using instanceof
      10. strictfp
      11. Native Methods
      12. Problems with Native Methods
      13. Using assert
        1. Assertion Enabling and Disabling Options
      14. Static Import
      15. Invoking Overloaded Constructors Through this( )
      16. Compact API Profiles
    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. Erasure
        1. Bridge Methods
      13. Ambiguity Errors
      14. 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
  9. Part II: The Java Library
    1. Chapter 16: 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( )
      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 17: 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. Memory Management
        2. Executing Other Programs
      5. ProcessBuilder
      6. System
        1. Using currentTimeMillis( ) to Time Program Execution.
        2. Using arraycopy( )
        3. Environment Properties
      7. Object
      8. Using clone( ) and the Cloneable Interface
      9. Class
      10. ClassLoader
      11. Math
        1. Trigonometric Functions
        2. Exponential Functions
        3. Rounding Functions
        4. Miscellaneous Math Methods
      12. StrictMath
      13. Compiler
      14. Thread, ThreadGroup, and Runnable
        1. The Runnable Interface
        2. Thread
        3. ThreadGroup
      15. ThreadLocal and InheritableThreadLocal
      16. Package
      17. RuntimePermission
      18. Throwable
      19. SecurityManager
      20. StackTraceElement
      21. Enum
      22. ClassValue
      23. The CharSequence Interface
      24. The Comparable Interface
      25. The Appendable Interface
      26. The Iterable Interface
      27. The Readable Interface
      28. The AutoCloseable Interface
      29. The Thread.UncaughtExceptionHandler Interface
      30. The java.lang Subpackages
        1. java.lang.annotation
        2. java.lang.instrument
        3. java.lang.invoke
        4. java.lang.management
        5. java.lang.ref
        6. java.lang.reflect
    3. Chapter 18: java.util Part 1: The Collections Framework
      1. Collections Overview
      2. JDK 5 Changed the Collections Framework
        1. Generics Fundamentally Changed the Collections Framework
        2. Autoboxing Facilitates the Use of Primitive Types
        3. The For-Each Style for Loop
      3. The Collection Interfaces
        1. The Collection Interface
        2. The List Interface
        3. The Set Interface
        4. The SortedSet Interface
        5. The NavigableSet Interface
        6. The Queue Interface
        7. The Deque Interface
      4. 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
      5. Accessing a Collection via an Iterator
        1. Using an Iterator
        2. The For-Each Alternative to Iterators
      6. Spliterators
      7. Storing User-Defined Classes in Collections
      8. The RandomAccess Interface
      9. Working with Maps
        1. The Map Interfaces
        2. The Map Classes
      10. Comparators
        1. Using a Comparator
      11. The Collection Algorithms
      12. Arrays
      13. The Legacy Classes and Interfaces
        1. The Enumeration Interface
        2. Vector
        3. Stack
        4. Dictionary
        5. Hashtable
        6. Properties
        7. Using store( ) and load( )
      14. Parting Thoughts on Collections
    4. Chapter 19: 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. Observable
        1. The Observer Interface
        2. An Observer Example
      12. Timer and TimerTask
      13. Currency
      14. 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
      15. Scanner
        1. The Scanner Constructors
        2. Scanning Basics
        3. Some Scanner Examples
        4. Setting Delimiters
        5. Other Scanner Features
      16. The ResourceBundle, ListResourceBundle, and PropertyResourceBundle Classes
      17. Miscellaneous Utility Classes and Interfaces
      18. 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.regex
        7. java.util.spi
        8. java.util.stream
        9. java.util.zip
    5. Chapter 20: 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 21: Exploring NIO
      1. The NIO Classes
      2. NIO Fundamentals
        1. Buffers
        2. Channels
        3. Charsets and Selectors
      3. Enhancements Added to NIO by JDK 7
        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
      5. Pre-JDK 7 Channel-Based Examples
        1. Read a File, Pre-JDK 7
        2. Write to a File, Pre-JDK 7
    7. Chapter 22: Networking
      1. Networking Basics
      2. The 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
    8. Chapter 23: The Applet Class
      1. Two Types of Applets
      2. Applet Basics
        1. The Applet Class
      3. Applet Architecture
      4. An Applet Skeleton
        1. Applet Initialization and Termination
        2. Overriding update( )
      5. Simple Applet Display Methods
      6. Requesting Repainting
        1. A Simple Banner Applet
      7. Using the Status Window
      8. The HTML APPLET Tag
      9. Passing Parameters to Applets
        1. Improving the Banner Applet
      10. getDocumentBase( ) and getCodeBase( )
      11. AppletContext and showDocument( )
      12. The AudioClip Interface
      13. The AppletStub Interface
      14. Outputting to the Console
    9. Chapter 24: 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. Handling Mouse Events
        2. Handling Keyboard Events
      8. Adapter Classes
      9. Inner Classes
        1. Anonymous Inner Classes
    10. Chapter 25: 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
      4. Creating a Frame Window in an AWT-Based Applet
        1. Handling Events in a Frame Window
      5. Creating a Windowed Program
      6. Displaying Information Within a Window
      7. 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
      8. Working with Color
        1. Color Methods
        2. Setting the Current Graphics Color
        3. A Color Demonstration Applet
      9. Setting the Paint Mode
      10. Working with Fonts
        1. Determining the Available Fonts
        2. Creating and Selecting a Font
        3. Obtaining Font Information
      11. Managing Text Output Using FontMetrics
        1. Displaying Multiple Lines of Text
        2. Centering Text
        3. Multiline Text Alignment
    11. Chapter 26: 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. FileDialog
      15. A Word About Overriding paint( )
    12. Chapter 27: 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. ImageObserver
      4. Double Buffering
      5. MediaTracker
      6. ImageProducer
        1. MemoryImageSource
      7. ImageConsumer
        1. PixelGrabber
      8. ImageFilter
        1. CropImageFilter
        2. RGBImageFilter
      9. Additional Imaging Classes
    13. Chapter 28: 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
      3. Phaser
      4. Using an Executor
        1. A Simple Executor Example
        2. Using Callable and Future
      5. The TimeUnit Enumeration
      6. The Concurrent Collections
      7. Locks
      8. Atomic Operations
      9. 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
      10. The Concurrency Utilities Versus Java’s Traditional Approach
    14. Chapter 29: 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
    15. Chapter 30: Regular Expressions and Other Packages
      1. The Core Java API Packages
      2. Regular Expression Processing
        1. Pattern
        2. Matcher
        3. Regular Expression Syntax
        4. Demonstrating Pattern Matching
        5. Two Pattern-Matching Options
        6. Exploring Regular Expressions
      3. Reflection
      4. Remote Method Invocation (RMI)
        1. A Simple Client/Server Application Using RMI
      5. Formatting Date and Time with java.text
        1. DateFormat Class
        2. SimpleDateFormat Class
      6. The Time and Date API Added by JDK 8
        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 31: 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. Create a Swing Applet
      10. Painting in Swing
        1. Painting Fundamentals
        2. Compute the Paintable Area
        3. A Paint Example
    2. Chapter 32: 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 33: 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: Introducing GUI Programming with JavaFX
    1. Chapter 34: Introducing JavaFX GUI Programming
      1. JavaFX Basic Concepts
        1. The JavaFX Packages
        2. The Stage and Scene Classes
        3. Nodes and Scene Graphs
        4. Layouts
        5. The Application Class and the Lifecycle Methods
        6. Launching a JavaFX Application
      2. A JavaFX Application Skeleton
      3. Compiling and Running a JavaFX Program
      4. The Application Thread
      5. A Simple JavaFX Control: Label
      6. Using Buttons and Events
        1. Event Basics
        2. Introducing the Button Control
        3. Demonstrating Event Handling and the Button
      7. Drawing Directly on a Canvas
    2. Chapter 35: Exploring JavaFX Controls
      1. Using Image and ImageView
        1. Adding an Image to a Label
        2. Using an Image with a Button
      2. ToggleButton
      3. RadioButton
        1. Handling Change Events in a Toggle Group
        2. An Alternative Way to Handle Radio Buttons
      4. CheckBox
      5. ListView
        1. ListView Scrollbars
        2. Enabling Multiple Selections
      6. ComboBox
      7. TextField
      8. ScrollPane
      9. TreeView
      10. Introducing Effects and Transforms
        1. Effects
        2. Transforms
        3. Demonstrating Effects and Transforms
      11. Adding Tooltips
      12. Disabling a Control
    3. Chapter 36: Introducing JavaFX Menus
      1. Menu Basics
      2. An Overview of MenuBar, Menu, and MenuItem
        1. MenuBar
        2. Menu
        3. MenuItem
      3. Create a Main Menu
      4. Add Mnemonics and Accelerators to Menu Items
      5. Add Images to Menu Items
      6. Use RadioMenuItem and CheckMenuItem
      7. Create a Context Menu
      8. Create a Toolbar
      9. Put the Entire MenuDemo Program Together
      10. Continuing Your Exploration of JavaFX
  12. Part V: Applying Java
    1. Chapter 37: Java Beans
      1. What Is a Java Bean?
      2. Advantages of Java 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 Java Beans API
        1. Introspector
        2. PropertyDescriptor
        3. EventSetDescriptor
        4. MethodDescriptor
      8. A Bean Example
    2. Chapter 38: 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 javax.servlet Package
        1. The Servlet Interface
        2. The ServletConfg 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 javax.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
    3. Appendix: Using Java’s Documentation Comments
      1. The javadoc Tags
        1. @author
        2. {@code}
        3. @deprecated
        4. {@docRoot}
        5. @exception
        6. {@inheritDoc}
        7. {@link}
        8. {@linkplain}
        9. {@literal}
        10. @param
        11. @return
        12. @see
        13. @serial
        14. @serialData
        15. @serialField
        16. @since
        17. @throws
        18. {@value}
        19. @version
      2. The General Form of a Documentation Comment
      3. What javadoc Outputs
      4. An Example that Uses Documentation Comments
  13. Index

Product information

  • Title: Java: The Complete Reference, Ninth Edition, 9th Edition
  • Author(s): Herbert Schildt
  • Release date: April 2014
  • Publisher(s): McGraw Hill Computing
  • ISBN: 9780071823500