Preface xiii Acknowledgments xix Chapter 1: An Introduction to Java 1 1.1 Java as a Programming Platform 1 1.2 The Java "White Paper" Buzzwords 2 1.3 Java Applets and the Internet 7 1.4 A Short History of Java 9 1.5 Common Misconceptions about Java 12 Chapter 2: The Java Programming Environment 15 2.1 Installing the Java Development Kit 15 2.2 Using the Command-Line Tools 19 2.
3 Using an Integrated Development Environment 23 2.4 JShell 26 Chapter 3: Fundamental Programming Structures in Java 31 3.1 A Simple Java Program 31 3.2 Comments 34 3.3 Data Types 35 3.4 Variables and Constants 42 3.5 Operators 46 3.6 Strings 58 3.
7 Input and Output 73 3.8 Control Flow 80 3.9 Big Numbers 98 3.10 Arrays 101 Chapter 4: Objects and Classes 117 4.1 Introduction to Object-Oriented Programming 117 4.2 Using Predefined Classes 122 4.3 Defining Your Own Classes 131 4.4 Static Fields and Methods 143 4.
5 Method Parameters 151 4.6 Object Construction 157 4.7 Records 168 4.8 Packages 173 4.9 JAR Files 186 4.10 Documentation Comments 193 4.11 Class Design Hints 201 Chapter 5: Inheritance 205 5.1 Classes, Superclasses, and Subclasses 205 5.
2 Object: The Cosmic Superclass 226 5.3 Generic Array Lists 243 5.4 Object Wrappers and Autoboxing 251 5.5 Methods with a Variable Number of Arguments 255 5.6 Abstract Classes 257 5.7 Enumeration Classes 262 5.8 Sealed Classes 266 5.9 Pattern Matching 272 5.
10 Reflection 279 5.11 Design Hints for Inheritance 305 Chapter 6: Interfaces, Lambda Expressions, and Inner Classes 309 6.1 Interfaces 310 6.2 Lambda Expressions 334 6.3 Inner Classes 354 6.4 Service Loaders 372 6.5 Proxies 374 Chapter 7: Exceptions, Assertions, and Logging 381 7.1 Dealing with Errors 382 7.
2 Catching Exceptions 389 7.3 Tips for Using Exceptions 403 7.4 Using Assertions 407 7.5 Logging 412 7.6 Debugging Tips 427 Chapter 8: Generic Programming 433 8.1 Type Parameters 433 8.2 Generic Code and the Virtual Machine 442 8.3 Inheritance Rules for Generic Types 448 8.
4 Wildcard Types 450 8.5 Restrictions and Limitations 458 8.6 Reflection and Generics 471 Chapter 9: Collections 481 9.1 The Java Collections Framework 481 9.2 Interfaces in the Collections Framework 491 9.3 Concrete Collections 494 9.4 Maps 517 9.5 Copies and Views 530 9.
6 Algorithms 541 9.7 Legacy Collections 553 Chapter 10: Concurrency 565 10.1 Running Threads 565 10.2 Thread States 571 10.3 Thread Properties 574 10.4 Coordinating Tasks 583 10.5 Synchronization 601 10.6 Thread-Safe Collections 631 10.
7 Asynchronous Computations 648 10.8 Processes 663 Chapter 11: Annotations 673 11.1 Using Annotations 673 11.2 Defining Annotations 679 11.3 Annotations in the Java API 682 11.4 Processing Annotations at Runtime 686 11.5 Source-Level Annotation Processing 690 11.6 Bytecode Engineering 696 Chapter 12: The Java Platform Module System 705 12.
1 The Module Concept 705 12.2 Naming Modules 707 12.3 The Modular "Hello, World!" Program 707 12.4 Requiring Modules 709 12.5 Exporting Packages 711 12.6 Modular JARs 715 12.7 Modules and Reflective Access 716 12.8 Automatic Modules 719 12.
9 The Unnamed Module 721 12.10 Command-Line Flags for Migration 722 12.11 Transitive and Static Requirements 723 12.12 Importing Modules 725 12.13 Qualified Exporting and Opening 726 12.14 Service Loading 726 12.15 Tools for Working with Modules 729 Appendix 733 Index 739.