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

Book Description

Written by the inventors of the technology, The Java®Language Specification, Java SE 7 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 7, including the try-with-resources statement, multi-catch, precise rethrow, “diamond” syntax, strings-in-switch, and binary literals. 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. Title Page
  2. Copyright Page
  3. Table of Contents
  4. Preface to the Java SE 7 Edition
  5. Preface to the Third Edition
  6. Preface to the Second Edition
  7. Preface to the First Edition
  8. 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. References
  9. 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
  10. 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
  11. 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
  12. Chapter 5. Conversions and Promotions
    1. 5.1. Kinds of Conversion
    2. 5.2. Assignment Conversion
    3. 5.3. Method Invocation Conversion
    4. 5.4. String Conversion
    5. 5.5. Casting Conversion
    6. 5.6. Numeric Promotions
  13. 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
  14. 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
  15. 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. Enums
  16. Chapter 9. Interfaces
    1. 9.1. Interface Declarations
    2. 9.2. Interface Members
    3. 9.3. Field (Constant) Declarations
    4. 9.4. Abstract Method Declarations
    5. 9.5. Member Type Declarations
    6. 9.6. Annotation Types
    7. 9.7. Annotations
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. Chapter 15. Expressions
    1. 15.1. Evaluation, Denotation, and Result
    2. 15.2. Variables as Values
    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 Expressions
    11. 15.11. Field Access Expressions
    12. 15.12. Method Invocation Expressions
    13. 15.13. Array Access 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. Expression
    28. 15.28. Constant Expressions
  23. 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
  24. 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
  25. Chapter 18. Syntax
  26. Index
  27. Appendix A. Limited License Grant