Java语言规范(英文版)(第3版)

Preface
Preface to the Second Edition
Preface to the Third Edition
Introduction
1.1 Example Programs
1.2 Notation
1.3 Relationship to Predefined Classes and Interfaces
1.4 References
2 Grammars
2.1 Context-Free Grammars
2.2 The Lexical Grammar
2.3 The Syntactic Grammar
2.4 Grammar Notation
3 Lexical Structure
3.1 Unicode
3.2 Lexical Translations
3.3 Unicode Escapes
3.4 Line Terminators
3.5 Input Elements and Tokens
3.6 White Space
3.7 Comments
3.8 Identifiers
3.9 Keywords
3.10 Literals
3.10.1 Integer Literals
3.10.2 Floating-Point Literals
3.10.3 Boolean Literals
3.10.4 Character Literals
3.10.5 String Literals
3.10.6 Escape Sequences for Character and String Literals
3.10.7 The Null Literal
3.11 Separators
3.12 Operators
4 Types, Values, and Variables
4.1 The Kinds of Types and Values
4.2 Primitive Types and Values
4.2.1 Integral Types and Values
4.2.2 Integer Operations
4.2.3 Floating-Point Types, Formats, and Values
4.2.4 Floating-Point Operations
4.2.5 The boolean Type and boolean Values
4.3 Reference Types and Values
4.3.1 Objects
4.3.2 The Class Object
4.3.3 The Class String
4.3.4 When Reference Types Are the Same
4.4 Type Variables
4.5 parameterized Types
4.5.1 Type Arguments and Wildcards
4.5.1.1 Type Argument Containment and Equivalence
4.5.2 Members and Constructors of Parameterized Types
4.6 Type Erasure
4.7 Reifiable Types
4.8 Raw Types
4.9 Intersection Types
4.10 Subtyping
4.10.1 Subtyping among Primitive Types
4.10.2 Subtyping among Class and Interface Types
4.10.3 Subtyping among Array Types
4.11 Where Types Are Used
4.12 Variables
4.12.1 Variables of Primitive Type
4.12.2 Variables of Reference Type
4.12.2.1 Heap Pollution
4.12.3 Kinds of Variables
4.12.4 final Variables
4.12.5 Initial Values of Variables
4.12.6 Types, Classes, and Interfaces
5 Conversions and Promotions
5.1 Kinds of Conversion
5. l. 1 Identity Conversions
5.1.2 Widening Primitive Conversion
5.1.3 Narrowing Primitive Conversions
5.1.4 Widening and Narrowing Primitive Conversions
5.1.5 Widening Reference Conversions
5.1.6 Narrowing Reference Conversions
5.1.7 Boxing Conversion
5.1.8 Unboxing Conversion
5.1.9 Unchecked Conversion
5.1.10 Capture Conversion
5.1.11 String Conversions
5.1.12 Forbidden Conversions
5.1.13 Value Set Conversion
5.2 Assignment Conversion
5.3 Method Invocation Conversion
5.4 String Conversion
5.5 Casting Conversion
5.6 Numeric Promotions
5.6.1 Unary Numeric Promotion
5.6.2 Binary Numeric Promotion
6 Names
6.1 Declarations
6.2 Names and Identifiers
6.3 Scope of a Declaration
6.3.1 Shadowing Declarations
6.3.2 Obscured Declarations
6.4 Members and Inheritance
6.4.1 The Members of Type Variables, Parameterized Types, Raw Types and Intersection Types
6.4.2 The Members of a Package
6.4.3 The Members of a Class Type
6.4.4 The Members of an Interface Type
6.4.5 The Members of an Array Type
6.5 Determining the Meaning of a Name
6.5.1 Syntactic Classification of a Name According to Context
6.5.2 Reclassification of Contextually Ambiguous Names
6.5.3 Meaning of Package Names
6.5.3.1 Simple Package Names
7 Packages
8 Classes
8.1.1 Class Modifiers
8.1.1.1 abstract Classes
8.1.1.2 final Classes
8.1.1.3 stri ctfp Classes
8.1.2 Generic Classes and Type Parameters
8.1.3 Inner Classes and Enclosing Instances
8.1.4 Superclasses and Subclasses
8.1.5 Superinterfaces
8.1.6 Class Body and Member Declarations
8.2 Class Members
8.2.1 Examples of Inheritance
8.2.1.1 Example: Inheritance with Default Access
8.2.1.2 Inheritance with public and protected
8.2.1.3 Inheritance with private
8.2.1.4 Accessing Members of Inaccessible Classes
8.3 Field Declarations
8.3.1 Field Modifiers
8.3.1.1 static Fields
8.3.1.2 fi nal Fields
8.3.1.3 transient Fields
8.3.1.4 vo] ati 1 e Fields
8.3.2 Initialization of Fields
8.3.2.1 Initializers for Class Variables
8.3.2.2 Initializers for Instance Variables
8.3.2.3 Restrictions on the use of Fields during Initialization
8.3.3 Examples of Field Declarations
8.3.3.1 Example: Hiding of Class Variables
8.3.3.2 Example: Hiding of Instance Variables
8.3.3.3 Example: Multiply Inherited Fields
8.3.3.4 Example: Re-inheritance of Fields
8.4 Method Declarations
8.4.1 Formal Parameters
8.4.2 Method Signature
8.4.3 Method Modifiers
8.4.3.1 abst tact Methods
8.4.3.2 static Methods
8.4.3.3 fina] Methods
8.4.3.4 native Methods
8.4.3.5 strictfp Methods
8.4.3.6 synch roni zed Methods
8.4.4 Generic Methods
8.4.5 Method Return Type
8.4.6 Method Throws
8.4.7 Method Body
8.4.8 Inheritance, Overriding, and Hiding
8.4.8.1 Overriding (by Instance Methods)
8.4.8.2 Hiding (by Class Methods)
8.4.8.3 Requirements in Overriding and Hiding
6.5.3.2 Qualified Package Names
6.5.4 Meaning of PackageOrTypeNames
6.5.4.1 Simple PackageOrTypeNames
6.5.4.2 Qualified PackageOrTypeNames
6.5.5 Meaning of Type Names
6.5.5.1 Simple Type N. ames
6.5.5.2 Qualified Type Names
6.5.6 Meaning of Expression Names
6.5.6.1 Simple Expression Names
6.5.6.2 Qualified Expression Names
6.5.7 Meaning of Method Names
6.5.7.1 Simple Method Names
6.5.7.2 Qualified Method Names
6.6 Access Control 138
6.6.1 Determining Accessibility
6.6.2 Details on protected Access
6.6.2.1 Access to a protected Member
6.6.2.2 Qualified Access to a protected Constructor
6.6.3 An Example of Access Control
6.6.4 Example: Access to public and Non-public Classes
6.6.5 Example: Default-Access Fields, Methods, and Constructors
6.6.6 Example: public Fields, Methods, and Constructors
6.6.7 Example: protected Fields, Methods, and Constructors
6.6.8 Example: private Fields, Methods, and Constructors
6.7 Fully Qualified Names and Canonical Names
6.8 Naming Conventions
6.8.1 Package Names
6.8.2 Class and Interface Type Names
6.8.3 Type Variable Names
6.8.4 Method Names
6.8.5 Field Names
6.8.6 Constant Names
6.8.7 Local Variable and Parameter Names
7 Packages
7.1 Package Members
7.2 Host Support for Packages
7.2.1 Storing Packages in a File System
7.2.2 Storing Packages in a Database
7.3 Compilation Units
7.4 Package Declarations
7.4.1 Named Packages :
7.4.1.1 Package Annotations
7.4.2 Unnamed Packages
7.4.3 Observability of a Package
7.4.4 Scope of a Package Declaranon
7.5 Import Declarations
7.5.1 Single-Type-Import Declaration
7.5.2 Type-Import-on-Demand Declaration
7.5.3 Single Static Import Declaration
7.5.4 Static-Import-on-Demand Declaration
7.5.5 Automatic Imports
7.5.6 A Strange Example
7.6 Top Level Type Declarations
7.7 Unique Package Names
8 Classes
8.1 Class Declaration
9 Interfaces
10 Arrays
11 Exceptions
12 Execution
13 Binary Compatibility
14 Blocks and Statements
15 Expressions
16 Definite Assignment
17 Threads and Locks
18 Syntax
19 Index
20 Credits
21 Colophon
Preface to the Second Edition
Preface to the Third Edition
Introduction
1.1 Example Programs
1.2 Notation
1.3 Relationship to Predefined Classes and Interfaces
1.4 References
2 Grammars
2.1 Context-Free Grammars
2.2 The Lexical Grammar
2.3 The Syntactic Grammar
2.4 Grammar Notation
3 Lexical Structure
3.1 Unicode
3.2 Lexical Translations
3.3 Unicode Escapes
3.4 Line Terminators
3.5 Input Elements and Tokens
3.6 White Space
3.7 Comments
3.8 Identifiers
3.9 Keywords
3.10 Literals
3.10.1 Integer Literals
3.10.2 Floating-Point Literals
3.10.3 Boolean Literals
3.10.4 Character Literals
3.10.5 String Literals
3.10.6 Escape Sequences for Character and String Literals
3.10.7 The Null Literal
3.11 Separators
3.12 Operators
4 Types, Values, and Variables
4.1 The Kinds of Types and Values
4.2 Primitive Types and Values
4.2.1 Integral Types and Values
4.2.2 Integer Operations
4.2.3 Floating-Point Types, Formats, and Values
4.2.4 Floating-Point Operations
4.2.5 The boolean Type and boolean Values
4.3 Reference Types and Values
4.3.1 Objects
4.3.2 The Class Object
4.3.3 The Class String
4.3.4 When Reference Types Are the Same
4.4 Type Variables
4.5 parameterized Types
4.5.1 Type Arguments and Wildcards
4.5.1.1 Type Argument Containment and Equivalence
4.5.2 Members and Constructors of Parameterized Types
4.6 Type Erasure
4.7 Reifiable Types
4.8 Raw Types
4.9 Intersection Types
4.10 Subtyping
4.10.1 Subtyping among Primitive Types
4.10.2 Subtyping among Class and Interface Types
4.10.3 Subtyping among Array Types
4.11 Where Types Are Used
4.12 Variables
4.12.1 Variables of Primitive Type
4.12.2 Variables of Reference Type
4.12.2.1 Heap Pollution
4.12.3 Kinds of Variables
4.12.4 final Variables
4.12.5 Initial Values of Variables
4.12.6 Types, Classes, and Interfaces
5 Conversions and Promotions
5.1 Kinds of Conversion
5. l. 1 Identity Conversions
5.1.2 Widening Primitive Conversion
5.1.3 Narrowing Primitive Conversions
5.1.4 Widening and Narrowing Primitive Conversions
5.1.5 Widening Reference Conversions
5.1.6 Narrowing Reference Conversions
5.1.7 Boxing Conversion
5.1.8 Unboxing Conversion
5.1.9 Unchecked Conversion
5.1.10 Capture Conversion
5.1.11 String Conversions
5.1.12 Forbidden Conversions
5.1.13 Value Set Conversion
5.2 Assignment Conversion
5.3 Method Invocation Conversion
5.4 String Conversion
5.5 Casting Conversion
5.6 Numeric Promotions
5.6.1 Unary Numeric Promotion
5.6.2 Binary Numeric Promotion
6 Names
6.1 Declarations
6.2 Names and Identifiers
6.3 Scope of a Declaration
6.3.1 Shadowing Declarations
6.3.2 Obscured Declarations
6.4 Members and Inheritance
6.4.1 The Members of Type Variables, Parameterized Types, Raw Types and Intersection Types
6.4.2 The Members of a Package
6.4.3 The Members of a Class Type
6.4.4 The Members of an Interface Type
6.4.5 The Members of an Array Type
6.5 Determining the Meaning of a Name
6.5.1 Syntactic Classification of a Name According to Context
6.5.2 Reclassification of Contextually Ambiguous Names
6.5.3 Meaning of Package Names
6.5.3.1 Simple Package Names
7 Packages
8 Classes
8.1.1 Class Modifiers
8.1.1.1 abstract Classes
8.1.1.2 final Classes
8.1.1.3 stri ctfp Classes
8.1.2 Generic Classes and Type Parameters
8.1.3 Inner Classes and Enclosing Instances
8.1.4 Superclasses and Subclasses
8.1.5 Superinterfaces
8.1.6 Class Body and Member Declarations
8.2 Class Members
8.2.1 Examples of Inheritance
8.2.1.1 Example: Inheritance with Default Access
8.2.1.2 Inheritance with public and protected
8.2.1.3 Inheritance with private
8.2.1.4 Accessing Members of Inaccessible Classes
8.3 Field Declarations
8.3.1 Field Modifiers
8.3.1.1 static Fields
8.3.1.2 fi nal Fields
8.3.1.3 transient Fields
8.3.1.4 vo] ati 1 e Fields
8.3.2 Initialization of Fields
8.3.2.1 Initializers for Class Variables
8.3.2.2 Initializers for Instance Variables
8.3.2.3 Restrictions on the use of Fields during Initialization
8.3.3 Examples of Field Declarations
8.3.3.1 Example: Hiding of Class Variables
8.3.3.2 Example: Hiding of Instance Variables
8.3.3.3 Example: Multiply Inherited Fields
8.3.3.4 Example: Re-inheritance of Fields
8.4 Method Declarations
8.4.1 Formal Parameters
8.4.2 Method Signature
8.4.3 Method Modifiers
8.4.3.1 abst tact Methods
8.4.3.2 static Methods
8.4.3.3 fina] Methods
8.4.3.4 native Methods
8.4.3.5 strictfp Methods
8.4.3.6 synch roni zed Methods
8.4.4 Generic Methods
8.4.5 Method Return Type
8.4.6 Method Throws
8.4.7 Method Body
8.4.8 Inheritance, Overriding, and Hiding
8.4.8.1 Overriding (by Instance Methods)
8.4.8.2 Hiding (by Class Methods)
8.4.8.3 Requirements in Overriding and Hiding
6.5.3.2 Qualified Package Names
6.5.4 Meaning of PackageOrTypeNames
6.5.4.1 Simple PackageOrTypeNames
6.5.4.2 Qualified PackageOrTypeNames
6.5.5 Meaning of Type Names
6.5.5.1 Simple Type N. ames
6.5.5.2 Qualified Type Names
6.5.6 Meaning of Expression Names
6.5.6.1 Simple Expression Names
6.5.6.2 Qualified Expression Names
6.5.7 Meaning of Method Names
6.5.7.1 Simple Method Names
6.5.7.2 Qualified Method Names
6.6 Access Control 138
6.6.1 Determining Accessibility
6.6.2 Details on protected Access
6.6.2.1 Access to a protected Member
6.6.2.2 Qualified Access to a protected Constructor
6.6.3 An Example of Access Control
6.6.4 Example: Access to public and Non-public Classes
6.6.5 Example: Default-Access Fields, Methods, and Constructors
6.6.6 Example: public Fields, Methods, and Constructors
6.6.7 Example: protected Fields, Methods, and Constructors
6.6.8 Example: private Fields, Methods, and Constructors
6.7 Fully Qualified Names and Canonical Names
6.8 Naming Conventions
6.8.1 Package Names
6.8.2 Class and Interface Type Names
6.8.3 Type Variable Names
6.8.4 Method Names
6.8.5 Field Names
6.8.6 Constant Names
6.8.7 Local Variable and Parameter Names
7 Packages
7.1 Package Members
7.2 Host Support for Packages
7.2.1 Storing Packages in a File System
7.2.2 Storing Packages in a Database
7.3 Compilation Units
7.4 Package Declarations
7.4.1 Named Packages :
7.4.1.1 Package Annotations
7.4.2 Unnamed Packages
7.4.3 Observability of a Package
7.4.4 Scope of a Package Declaranon
7.5 Import Declarations
7.5.1 Single-Type-Import Declaration
7.5.2 Type-Import-on-Demand Declaration
7.5.3 Single Static Import Declaration
7.5.4 Static-Import-on-Demand Declaration
7.5.5 Automatic Imports
7.5.6 A Strange Example
7.6 Top Level Type Declarations
7.7 Unique Package Names
8 Classes
8.1 Class Declaration
9 Interfaces
10 Arrays
11 Exceptions
12 Execution
13 Binary Compatibility
14 Blocks and Statements
15 Expressions
16 Definite Assignment
17 Threads and Locks
18 Syntax
19 Index
20 Credits
21 Colophon
James Gosling 拥有卡内基-梅隆大学计算机科学博士学位。他是Java语言的创建者,Sun公司Developer Products组的高级成员和首席术官,同时还是计算机业最负盛名的程序员之一。1996年。他获得了《Software Development》杂志“最佳编程奖”。他曾开发过NeWS——Sun公司的网络扩展窗口系统,并且是卡内基-梅隆大学Andrwe项目的负责人之一。
本书由“java之父”Jame Gosling 以及另外三位高级大师撰写而成,无论是对java语言的初学者还是专业程序员都具有极高的价值,是关于java程序设计语言的技术参考书。
本书侧重于java技术细节和内幕,全面,准确,详尽地介绍了java语言及其语法,论述了java编译器所要检查的语法和java运行模式的各个方面,同时还描述了java语言重要的新特征。
本书侧重于java技术细节和内幕,全面,准确,详尽地介绍了java语言及其语法,论述了java编译器所要检查的语法和java运行模式的各个方面,同时还描述了java语言重要的新特征。
比价列表
公众号、微信群
缺书网微信公众号
扫码进群实时获取购书优惠




