You are previewing The Java® Language Specification, Java SE 8 Edition.
O'Reilly logo
The Java® Language Specification, Java SE 8 Edition

Book Description

Written by the inventors of the technology, The Java® Language Specification, Java SE 8 Edition is the definitive technical reference for the Java programming language.

The book provides complete, accurate, and detailed coverage of the Java programming language. It fully describes the new features added in Java SE 8, including lambda expressions, method references, default methods, type annotations, and repeating annotations. The book also includes many explanatory notes and carefully distinguishes the formal rules of the language from the practical behavior of compilers.

Table of Contents

  1. About This eBook
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. Table of Contents
  6. Preface to the Java SE 8 Edition
  7. Chapter 1. Introduction
    1. 1.1 Organization of the Specification
    2. 1.2 Example Programs
    3. 1.3 Notation
    4. 1.4 Relationship to Predefined Classes and Interfaces
    5. 1.5 Feedback
    6. 1.6 References
  8. Chapter 2. Grammars
    1. 2.1 Context-Free Grammars
    2. 2.2 The Lexical Grammar
    3. 2.3 The Syntactic Grammar
    4. 2.4 Grammar Notation
  9. Chapter 3. Lexical Structure
    1. 3.1 Unicode
    2. 3.2 Lexical Translations
    3. 3.3 Unicode Escapes
    4. 3.4 Line Terminators
    5. 3.5 Input Elements and Tokens
    6. 3.6 White Space
    7. 3.7 Comments
    8. 3.8 Identifiers
    9. 3.9 Keywords
    10. 3.10 Literals
    11. 3.11 Separators
    12. 3.12 Operators
  10. Chapter 4. Types, Values, and Variables
    1. 4.1 The Kinds of Types and Values
    2. 4.2 Primitive Types and Values
    3. 4.3 Reference Types and Values
    4. 4.4 Type Variables
    5. 4.5 Parameterized Types
    6. 4.6 Type Erasure
    7. 4.7 Reifiable Types
    8. 4.8 Raw Types
    9. 4.9 Intersection Types
    10. 4.10 Subtyping
    11. 4.11 Where Types Are Used
    12. 4.12 Variables
  11. Chapter 5. Conversions and Contexts
    1. 5.1 Kinds of Conversion
    2. 5.2 Assignment Contexts
    3. 5.3 Invocation Contexts
    4. 5.4 String Contexts
    5. 5.5 Casting Contexts
    6. 5.6 Numeric Contexts
  12. Chapter 6. Names
    1. 6.1 Declarations
    2. 6.2 Names and Identifiers
    3. 6.3 Scope of a Declaration
    4. 6.4 Shadowing and Obscuring
    5. 6.5 Determining the Meaning of a Name
    6. 6.6 Access Control
    7. 6.7 Fully Qualified Names and Canonical Names
  13. Chapter 7. Packages
    1. 7.1 Package Members
    2. 7.2 Host Support for Packages
    3. 7.3 Compilation Units
    4. 7.4 Package Declarations
    5. 7.5 Import Declarations
    6. 7.6 Top Level Type Declarations
  14. Chapter 8. Classes
    1. 8.1 Class Declarations
    2. 8.2 Class Members
    3. 8.3 Field Declarations
    4. 8.4 Method Declarations
    5. 8.5 Member Type Declarations
    6. 8.6 Instance Initializers
    7. 8.7 Static Initializers
    8. 8.8 Constructor Declarations
    9. 8.9 Enum Types
  15. Chapter 9. Interfaces
    1. 9.1 Interface Declarations
    2. 9.2 Interface Members
    3. 9.3 Field (Constant) Declarations
    4. 9.4 Method Declarations
    5. 9.5 Member Type Declarations
    6. 9.6 Annotation Types
    7. 9.7 Annotations
    8. 9.8 Functional Interfaces
    9. 9.9 Function Types
  16. Chapter 10. Arrays
    1. 10.1 Array Types
    2. 10.2 Array Variables
    3. 10.3 Array Creation
    4. 10.4 Array Access
    5. 10.5 Array Store Exception
    6. 10.6 Array Initializers
    7. 10.7 Array Members
    8. 10.8 Class Objects for Arrays
    9. 10.9 An Array of Characters Is Not a String
  17. Chapter 11. Exceptions
    1. 11.1 The Kinds and Causes of Exceptions
    2. 11.2 Compile-Time Checking of Exceptions
    3. 11.3 Run-Time Handling of an Exception
  18. Chapter 12. Execution
    1. 12.1 Java Virtual Machine Startup
    2. 12.2 Loading of Classes and Interfaces
    3. 12.3 Linking of Classes and Interfaces
    4. 12.4 Initialization of Classes and Interfaces
    5. 12.5 Creation of New Class Instances
    6. 12.6 Finalization of Class Instances
    7. 12.7 Unloading of Classes and Interfaces
    8. 12.8 Program Exit
  19. Chapter 13. Binary Compatibility
    1. 13.1 The Form of a Binary
    2. 13.2 What Binary Compatibility Is and Is Not
    3. 13.3 Evolution of Packages
    4. 13.4 Evolution of Classes
    5. 13.5 Evolution of Interfaces
  20. Chapter 14. Blocks and Statements
    1. 14.1 Normal and Abrupt Completion of Statements
    2. 14.2 Blocks
    3. 14.3 Local Class Declarations
    4. 14.4 Local Variable Declaration Statements
    5. 14.5 Statements
    6. 14.6 The Empty Statement
    7. 14.7 Labeled Statements
    8. 14.8 Expression Statements
    9. 14.9 The if Statement
    10. 14.10 The assert Statement
    11. 14.11 The switch Statement
    12. 14.12 The while Statement
    13. 14.13 The do Statement
    14. 14.14 The for Statement
    15. 14.15 The break Statement
    16. 14.16 The continue Statement
    17. 14.17 The return Statement
    18. 14.18 The throw Statement
    19. 14.19 The synchronized Statement
    20. 14.20 The try statement
    21. 14.21 Unreachable Statements
  21. Chapter 15. Expressions
    1. 15.1 Evaluation, Denotation, and Result
    2. 15.2 Forms of Expressions
    3. 15.3 Type of an Expression
    4. 15.4 FP-strict Expressions
    5. 15.5 Expressions and Run-Time Checks
    6. 15.6 Normal and Abrupt Completion of Evaluation
    7. 15.7 Evaluation Order
    8. 15.8 Primary Expressions
    9. 15.9 Class Instance Creation Expressions
    10. 15.10 Array Creation and Access Expressions
    11. 15.11 Field Access Expressions
    12. 15.12 Method Invocation Expressions
    13. 15.13 Method Reference Expressions
    14. 15.14 Postfix Expressions
    15. 15.15 Unary Operators
    16. 15.16 Cast Expressions
    17. 15.17 Multiplicative Operators
    18. 15.18 Additive Operators
    19. 15.19 Shift Operators
    20. 15.20 Relational Operators
    21. 15.21 Equality Operators
    22. 15.22 Bitwise and Logical Operators
    23. 15.23 Conditional-And Operator &&
    24. 15.24 Conditional-Or Operator ||
    25. 15.25 Conditional Operator ? :
    26. 15.26 Assignment Operators
    27. 15.27 Lambda Expressions
    28. 15.28 Constant Expressions
  22. Chapter 16. Definite Assignment
    1. 16.1 Definite Assignment and Expressions
    2. 16.2 Definite Assignment and Statements
    3. 16.3 Definite Assignment and Parameters
    4. 16.4 Definite Assignment and Array Initializers
    5. 16.5 Definite Assignment and Enum Constants
    6. 16.6 Definite Assignment and Anonymous Classes
    7. 16.7 Definite Assignment and Member Types
    8. 16.8 Definite Assignment and Static Initializers
    9. 16.9 Definite Assignment, Constructors, and Instance Initializers
  23. Chapter 17. Threads and Locks
    1. 17.1 Synchronization
    2. 17.2 Wait Sets and Notification
    3. 17.3 Sleep and Yield
    4. 17.4 Memory Model
    5. 17.5 final Field Semantics
    6. 17.6 Word Tearing
    7. 17.7 Non-Atomic Treatment of double and long
  24. Chapter 18. Type Inference
    1. 18.1 Concepts and Notation
    2. 18.2 Reduction
    3. 18.3 Incorporation
    4. 18.4 Resolution
    5. 18.5 Uses of Inference
  25. Chapter 19. Syntax
  26. Index
  27. Appendix A. Limited License Grant
    1. Limited License Grants
    2. Disclaimer of Warranties
    3. Limitation of Liability
    4. Restricted Rights Legend
    5. Report
    6. General Terms