The Java Language Specification, 2/e (Paperback)
暫譯: Java 語言規範(第二版)(平裝本)

James Gosling, Bill Joy, Guy L. Steele Jr., Gilad Bracha

  • 出版商: Addison Wesley
  • 出版日期: 2000-06-15
  • 定價: $1,200
  • 售價: 5.0$600
  • 語言: 英文
  • 頁數: 544
  • 裝訂: Paperback
  • ISBN: 0201310082
  • ISBN-13: 9780201310085
  • 相關分類: Java 程式語言
  • 立即出貨(限量)

買這商品的人也買了...

相關主題

商品描述


Description

The definitive Java 2 reference for every developer: a long-awaited, complete update by the language's creators!

  • Covers every key aspect of the Java language.
  • Classes, interface types, arrays, exceptions, expressions, threading, locks, and more.
  • Detailed chapters on program execution, structure, and binary compatibility.
For nearly five years, one book has served as the definitive reference to Java for all serious developers: The Java Language Specification, by James Gosling, Bill Joy, and Guy Steele. Now, these world-renowned Java authorities (along with new co-author Gilad Bracha) have delivered a monumental update. This completely revised Second Edition covers the Java 2™ Platform Standard Edition Version 1.3 with unprecedented depth and precision, offering the invaluable insights of Java's creators to every developer. There is no better source for learning everything about the Syntax and Semantics of the Java programming language. Developers will turn to this book again and again.

James Gosling is Sun Fellow and Sun Microsystems Vice President, and the inventor of the Java programming language. Bill Joy is chief scientist of Sun Microsystems, Inc. Guy Steele, Distinguished Engineer at Sun Microsystems, Inc., is responsible for the specification of the Java programming language. Gilad Bracha is a staff engineer at Sun Microsystems specializing in Java software.

Back to Top


Appropriate Courses

Java--Intermediate Programming.

Back to Top


Table Of Contents

Preface.
Preface to the Second Edition.
1. Introduction.
Example Programs.
Notation.
Relationship to Predefined Classes and Interfaces.
References.

2. Grammars.
Context-Free Grammars.
The Lexical Grammar.
The Syntactic Grammar.
Grammar Notation.

3. Lexical Structure.
Unicode.
Lexical Translations.
Unicode Escapes.
Line Terminators.
Input Elements and Tokens.
White Space.
Comments.
Identifiers.
Keywords.
Literals.
Integer Literals.
Floating-Point Literals.
Boolean Literals.
Character Literals.
String Literals.
Escape Sequences for Character and String Literals.
The Null Literal.

Separators.
Operators.

4. Types, Values, and Variables.
The Kinds of Types and Values.
Primitive Types and Values.
Integral Types and Values.
Integer Operations.
Floating-Point Types, Formats, and Values.
Floating-Point Operations.
The boolean Type and boolean Values.

Reference Types and Values
Objects.
The Class Object.
The Class String.
When Reference Types Are the Same.

Where Types Are Used.
Variables.
Variables of Primitive Type.
Variables of Reference Type.
Kinds of Variables.
Final Variables.
Initial Values of Variables.
Types, Classes, and Interfaces.


5. Conversions and Promotions.
Kinds of Conversion.
Identity Conversions.
Widening Primitive Conversion.
Narrowing Primitive Conversions.
Widening Reference Conversions.
Narrowing Reference Conversions.
String Conversions.
Forbidden Conversions.
Value Set Conversion.

Assignment Conversion.
Method Invocation Conversion.
String Conversion.
Casting Conversion.
Numeric Promotions.
Unary Numeric Promotion.
Binary Numeric Promotion.


6. Names.
Declarations.
Names and Identifiers.
Scope of a Declaration.
Shadowing Declarations.
Obscured Declarations.

Members and Inheritance.
The Members of a Package.
The Members of a Class Type.
The Members of an Interface Type.
The Members of an Array Type.

Determining the Meaning of a Name.
Syntactic Classification of a Name According to Context.
Reclassification of Contextually Ambiguous Names.
Meaning of Package Names.
Simple Package Names.
Qualified Package Names.

Meaning of PackageOrTypeNames.
Simple PackageOrTypeNames.
Qualified PackageOrTypeNames.

Meaning of Type Names.
Simple Type Names.
Qualified Type Names.

Meaning of Expression Names.
Simple Expression Names.
Qualified Expression Names.

Meaning of Method Names.
Simple Method Names.
Qualified Method Names.


Access Control.
Determining Accessibility.
Details on protected Access.
Access to a protected Member.
Qualified Access to a protected Constructor.

An Example of Access Control.
Example: Access to public and Non-public Classes.
Example: Default-Access Fields, Methods, and Constructors.
Example: public Fields, Methods, and Constructors.
Example: protected Fields, Methods, and Constructors.
Example: private Fields, Methods, and Constructors.

Fully Qualified Names and Canonical Names.
Naming Conventions.
Package Names.
Class and Interface Type Names.
Method Names.
Field Names.
Constant Names.
Local Variable and Parameter Names.


7. Packages.
Package Members.
Host Support for Packages.
Storing Packages in a File System.
Storing Packages in a Database.

Compilation Units.
Package Declarations.
Named Packages.
Unnamed Packages.
Observability of a Package.
Scope of a Package Declaration.

Import Declarations.
Single-Type-Import Declaration.
Type-Import-on-Demand Declaration.
Automatic Imports.
A Strange Example.

Top Level Type Declarations.
Unique Package Names.

8. Classes.
Class Declaration.
Class Modifiers.
abstract Classes.
final Classes.
strictfp Classes.

Inner Classes and Enclosing Instances.
Superclasses and Subclasses.
Superinterfaces.
Class Body and Member Declarations.

Class Members.
Examples of Inheritance.
Example: Inheritance with Default Access.
Inheritance with public and protected.
Inheritance with private.
Accessing Members of Inaccessible Classes.


Field Declarations.
Field Modifiers.
static Fields.
final Fields.
transient Fields.
volatile Fields.

Initialization of Fields.
Initializers for Class Variables.
Initializers for Instance Variables.
Restrictions on the use of Fields during Initialization.

Examples of Field Declarations.
Example: Hiding of Class Variables.
Example: Hiding of Instance Variables.
Example: Multiply Inherited Fields.
Example: Re-inheritance of Fields.


Method Declarations.
Formal Parameters.
Method Signature.
Method Modifiers.
abstract Methods.
static Methods.
final Methods.
native Methods.
strictfp Methods.
synchronized Methods.

Method Throws.
Method Body.
Inheritance, Overriding, and Hiding.
Overriding (by Instance Methods).
Hiding (by Class Methods).
Requirements in Overriding and Hiding.
Inheriting Methods with the Same Signature.

Overloading.
Examples of Method Declarations.
Example: Overriding.
Example: Overloading, Overriding, and Hiding.
Example: Incorrect Overriding.
Example: Overriding versus Hiding.
Example: Invocation of Hidden Class Methods.
Large Example of Overriding.
Example: Incorrect Overriding because of Throws.


Member Type Declarations.
Access Modifiers.
Static Member Type Declarations.

Instance Initializers.
Static Initializers.
Constructor Declarations.
Formal Parameters.
Constructor Signature.
Constructor Modifiers.
Constructor Throws.
Constructor Body.
Explicit Constructor Invocations.

Constructor Overloading.
Default Constructor.
Preventing Instantiation of a Class.


9. Interfaces.
Interface Declarations.
Interface Modifiers.
abstract Interfaces.
strictfp Interfaces.

Superinterfaces and Subinterfaces.
Interface Body and Member Declarations.
Access to Interface Member Names.

Interface Members.
Field (Constant) Declarations.
Initialization of Fields in Interfaces.
Examples of Field Declarations.
Ambiguous Inherited Fields.
Multiply Inherited Fields.


Abstract Method Declarations.
Inheritance and Overriding.
Overloading.
Examples of Abstract Method Declarations.
Example: Overriding.
Example: Overloading.


Member Type Declarations.

10. Arrays.
Array Types.
Array Variables.
Array Creation.
Array Access.
Arrays: A Simple Example.
Array Initializers.
Array Members.
Class Objects for Arrays.
An Array of Characters is Not a String.
Array Store Exception.

11. Exceptions.
The Causes of Exceptions.
Compile-Time Checking of Exceptions.
Why Errors are Not Checked.
Why Runtime Exceptions are Not Checked.

Handling of an Exception.
Exceptions are Precise.
Handling Asynchronous Exceptions.

An Example of Exceptions.
The Exception Hierarchy.
Loading and Linkage Errors.
Virtual Machine Errors.


12. Execution.
Virtual Machine Start-Up.
Load the Class Test.
Link Test: Verify, Prepare, (Optionally) Resolve.
Initialize Test: Execute Initializers.
Invoke Test.main.

Loading of Classes and Interfaces.
The Loading Process.

Linking of Classes and Interfaces.
Verification of the Binary Representation.
Preparation of a Class or Interface Type.
Resolution of Symbolic References.

Initialization of Classes and Interfaces.
When Initialization Occurs.
Detailed Initialization Procedure.
Initialization: Implications for Code Generation.

Creation of New Class Instances.
Finalization of Class Instances.
Implementing Finalization.
Finalizer Invocations are Not Ordered.

Unloading of Classes and Interfaces.
Program Exit.

13. Binary Compatibility.
The Form of a Binary.
What Binary Compatibility Is and Is Not.
Evolution of Packages.
Evolution of Classes.
Abstract Classes.
Final Classes.
Public Classes.
Superclasses and Superinterfaces.
Class Body and Member Declarations.
Access to Members and Constructors.
Field Declarations.
Final Fields and Constants.
Static Fields.
Transient Fields.
Method and Constructor Declarations.
Method and Constructor Parameters.
Method Result Type.
Abstract Methods.
Final Methods.
Native Methods.
Static Methods.
Synchronized Methods.
Method and Constructor Throws.
Method and Constructor Body.
Method and Constructor Overloading.
Method Overriding.
Static Initializers.

Evolution of Interfaces.
Public Interfaces.
Superinterfaces.
The Interface Members.
Field Declarations.
Abstract Method Declarations.


14. Blocks and Statements.
Normal and Abrupt Completion of Statements.
Blocks.
Local Class Declarations.
Local Variable Declaration Statements.
Local Variable Declarators and Types.
Scope of Local Variable Declarations.
Shadowing of Names by Local Variables.
Execution of Local Variable Declarations.

Statements.
The Empty Statement.
Labeled Statements.
Expression Statements.
The if Statement.
The if—then Statement.
The if—then—else Statement.

The switch Statement.
The while Statement.
Abrupt Completion.

The do Statement.
Abrupt Completion.
Example of do statement.

The for Statement.
Initialization of for statement.
Iteration of for statement.
Abrupt Completion of for statement.

The break Statement.
The continue Statement.
The return Statement.
The throw Statement.
The synchronized Statement.
The try statement.
Execution of try—catch.
Execution of try—catch—finally.

Unreachable Statements.

15. Expressions.
Evaluation, Denotation, and Result.
Variables as Values.
Type of an Expression.
FP-strict Expressions.
Expressions and Run-Time Checks.
Normal and Abrupt Completion of Evaluation.
Evaluation Order.
Evaluate Left-Hand Operand First.
Evaluate Operands before Operation.
Evaluation Respects Parentheses and Precedence.
Argument Lists are Evaluated Left-to-Right.
Evaluation Order for Other Expressions.

Primary Expressions.
Lexical Literals.
Class Literals.
this.
Qualified this.
Parenthesized Expressions.

Class Instance Creation Expressions.
Determining the Class being Instantiated.
Determining Enclosing Instances.
Choosing the Constructor and its Arguments.
Run-time Evaluation of Class Instance Creation Expressions.
Anonymous Class Declarations.
Anonymous Constructors.

Example: Evaluation Order and Out-of-Memory Detection.

Array Creation Expressions.
Run-time Evaluation of Array Creation Expressions.
Example: Array Creation Evaluation Order.
Example: Array Creation and Out-of-Memory Detection.

Field Access Expressions.
Field Access Using a Primary.
Accessing Superclass Members using super.

Method Invocation Expressions.
Compile-Time Step 1: Determine Class or Interface to Search.
Compile-Time Step 2: Determine Method Signature.
Find Methods that are Applicable and Accessible.
Choose the Most Specific Method.
Example: Overloading Ambiguity.
Example: Return Type Not Considered.
Example: Compile-Time Resolution.

Compile-Time Step 3: Is the Chosen Method Appropriate?
Runtime Evaluation of Method Invocation.
Compute Target Reference (If Necessary).

Evaluate Arguments.
Check Accessibility of Type and Method.
Locate Method to Invoke.
Create Frame, Synchronize, Transfer Control.
Example: Target Reference and Static Methods.
Example: Evaluation Order.
Example: Overriding.
Example: Method Invocation using super.


Array Access Expressions.
Runtime Evaluation of Array Access.
Examples: Array Access Evaluation Order.

Postfix Expressions.
Postfix Increment Operator.
Postfix Decrement Operator.

Unary Operators.
Prefix Increment Operator.
Prefix Decrement Operator.
Unary Plus Operator.
Unary Minus Operator.
Bitwise Complement Operator ~
Logical Complement Operator !

Cast Expressions.
Multiplicative Operators.
Multiplication Operator *
Division Operator /
Remainder Operator %

Additive Operators.
String Concatenation Operator +
String Conversion.
Optimization of String Concatenation.
Examples of String Concatenation.

Additive Operators (+ and -) for Numeric Types.

Shift Operators.
Relational Operators.
Numerical Comparison Operators <, <=, >, and >=.
Type Comparison Operator instanceof.

Equality Operators.
Numerical Equality Operators == and !=
Boolean Equality Operators == and !=
Reference Equality Operators == and !=

Bitwise and Logical Operators.
Integer Bitwise Operators &, ^, and |
Boolean Logical Operators &, ^, and |

Conditional-And Operator &&
Conditional-Or Operator ||
Conditional Operator ? :
Assignment Operators.
Simple Assignment Operator =
Compound Assignment Operators.

Expression.
Constant Expression.

16. Definite Assignment.
Definite Assignment and Expressions.
Boolean Constant Expressions.
The Boolean Operator &&
The Boolean Operator ||
The Boolean Operator !
The Boolean Operator ? :
The Conditional Operator ? :
Assignment Expressions.
Operators ++ and --
Other Expressions.

Definite Assignment and Statements.
Empty Statements.
Blocks.
Local Class Declaration Statements.
Local Variable Declaration Statements.
Labeled Statements.
Expression Statements.
if Statements.
switch Statements.
while Statements.
do Statements.
for Statements.
Initialization Part.
Incrementation Part.

break, continue, return, and throw Statements.
synchronized Statements.
try Statements.

Definite Assignment and Parameters.
Definite Assignment and Array Initializers.
Definite Assignment and Anonymous Classes.
Definite Assignment and Member Types.
Definite Assignment and Static Initializers.
Definite Assignment, Constructors, and Instance Initializers.

17. Threads and Locks.
Terminology and Framework.
Execution Order.
Rules about Variables.
Nonatomic Treatment of double and long.
Rules about Locks.
Rules about the Interaction of Locks and Variables.
Rules for Volatile Variables.
Prescient Store Actions.
Discussion.
Example: Possible Swap.
Example: Out-of-Order Writes.
Threads.
Locks and Synchronization.
Wait Sets and Notification.

18. Syntax.
The Grammar of the Java Programming Language.

Index.
Credits.
Colophon. 0201310082T04062001


Back to Top

商品描述(中文翻譯)

```

描述


每位開發者的權威 Java 2 參考書:由語言創造者帶來的期待已久的完整更新!


  • 涵蓋 Java 語言的每個關鍵方面。

  • 類別、介面類型、陣列、例外、表達式、執行緒、鎖定等。

  • 詳細章節介紹程式執行、結構和二進位相容性。

在近五年來,有一本書成為所有認真開發者的 Java 權威參考書:《Java 語言規範》,作者為 James Gosling、Bill Joy 和 Guy Steele。現在,這些世界知名的 Java 專家(以及新合著者 Gilad Bracha)提供了一次重大的更新。這本完全修訂的第二版以前所未有的深度和精確度涵蓋了 Java 2™ 平台標準版 1.3,為每位開發者提供了 Java 創造者的寶貴見解。沒有比這本書更好的來源來學習 Java 程式語言的語法和語義。開發者將一次又一次地參考這本書。

James Gosling 是 Sun Fellow 和 Sun Microsystems 副總裁,也是 Java 程式語言的發明者。Bill Joy 是 Sun Microsystems, Inc. 的首席科學家。Guy Steele 是 Sun Microsystems, Inc. 的傑出工程師,負責 Java 程式語言的規範。Gilad Bracha 是 Sun Microsystems 的一名專職工程師,專注於 Java 軟體。

回到頂部


適合的課程


Java--中級程式設計。

回到頂部


目錄


前言。
第二版前言。
1. 介紹。
範例程式。
符號。
與預定義類別和介面的關係。
參考文獻。


2. 文法。
無上下文文法。
詞法文法。
語法文法。
文法符號。


3. 詞法結構。
Unicode。
詞法翻譯。
Unicode 轉義。
行結束符。
輸入元素和標記。
空白。
註解。
識別符。
關鍵字。
字面量。
整數字面量。
浮點字面量。
布林字面量。
字元字面量。
字串字面量。
字元和字串字面量的轉義序列。
空值字面量。



分隔符。
運算符。


4. 類型、值和變數。
類型和值的種類。
原始類型和值。
整數類型和值。
整數運算。
浮點類型、格式和值。
浮點運算。
布林類型和布林值。



參考類型和值
物件。
類別物件。
字串類別。
當參考類型相同時。



類型的使用位置。
變數。
原始類型的變數。
參考類型的變數。
變數的種類。
最終變數。
變數的初始值。
類型、類別和介面。





5. 轉換和提升。
轉換的種類。
身份轉換。
擴展原始轉換。
縮小原始轉換。
擴展參考轉換。
縮小參考轉換。
字串轉換。
禁止的轉換。
值集轉換。



指派轉換。
方法調用轉換。
字串轉換。
類型轉換。
數值提升。
單元數值提升。
二元數值提升。





6. 名稱。
宣告。
名稱和識別符。
宣告的範圍。
隱蔽宣告。
被遮蔽的宣告。



成員和繼承。
套件的成員。
類別類型的成員。
介面類型的成員。
陣列類型的成員。



確定名稱的意義。
根據上下文的語法分類。
對上下文模糊名稱的重新分類。
套件名稱的意義。
簡單套件名稱。
合格套件名稱。



套件或類型名稱的意義。
簡單套件或類型名稱。
合格套件或類型名稱。



類型名稱的意義。
簡單類型名稱。
合格類型名稱。



表達式名稱的意義。
簡單表達式名稱。
合格表達式名稱。



方法名稱的意義。
簡單方法名稱。
合格方法名稱。






存取控制。
確定可存取性。
受保護存取的詳細資訊。
存取受保護的成員。
對受保護建構子的合格存取。



存取控制的範例。
範例:存取公共和非公共類別。
範例:預設存取欄位、方法和建構子。
範例:公共欄位、方法和建構子。
範例:受保護的欄位、方法和建構子。
範例:私有欄位、方法和建構子。



完全合格名稱和標準名稱。
命名慣例。
套件名稱。
類別和介面類型名稱。
方法名稱。
欄位名稱。
常數名稱。
本地變數和參數名稱。





7. 套件。
套件成員。
套件的主機支援。
在檔案系統中儲存套件。
在資料庫中儲存套件。



編譯單元。
套件宣告。
命名套件。
無名套件。
套件的可觀察性。
套件宣告的範圍。



匯入宣告。
單一類型匯入宣告。
按需匯入類型宣告。
自動匯入。
一個奇怪的範例。



類型的頂層宣告。
獨特的套件名稱。


8. 類別。
類別宣告。
類別修飾符。
抽象類別。
最終類別。
strictfp 類別。



內部類別和封閉實例。
超類和子類。
超介面。
類別主體和成員宣告。



類別成員。
繼承的範例。
範例:預設存取的繼承。
公共和受保護的繼承。
私有的繼承。
存取不可存取類別的成員。






欄位宣告。
欄位修飾符。
靜態欄位。
最終欄位。
瞬態欄位。
易失性欄位。



欄位的初始化。
類別變數的初始化。
實例變數的初始化。
初始化期間對欄位使用的限制。



欄位宣告的範例。
範例:隱藏類別變數。
範例:隱藏實例變數。
範例:多重繼承的欄位。
範例:欄位的再繼承。






方法宣告。
形式參數。
方法簽名。
方法修飾符。
抽象方法。
靜態方法。
最終方法。
本地方法。
strictfp 方法。
同步方法。



方法拋出。
方法主體。
繼承、覆寫和隱藏。
覆寫(通過實例方法)。
隱藏(通過類別方法)。
覆寫和隱藏的要求。
繼承具有相同簽名的方法。



方法重載。
方法宣告的範例。
範例:覆寫。
範例:重載、覆寫和隱藏。
範例:不正確的覆寫。
範例:覆寫與隱藏。
範例:調用隱藏的類別方法。
大範例的覆寫。
範例:因拋出而不正確的覆寫。






成員類型宣告。
存取修飾符。
靜態成員類型宣告。



實例初始化器。
靜態初始化器。
建構子宣告。
形式參數。
建構子簽名。
建構子修飾符。
建構子拋出。
建構子主體。
明確的建構子調用。



建構子重載。
預設建構子。
防止類別的實例化。





9. 介面。
介面宣告。
介面修飾符。
抽象介面。
strictfp 介面。



超介面和子介面。
介面主體和成員宣告。
存取介面成員名稱。



介面成員。
欄位(常數)宣告。
介面中欄位的初始化。
欄位宣告的範例。
模糊的繼承欄位。
多重繼承的欄位。






抽象方法宣告。
繼承和覆寫。
重載。
抽象方法宣告的範例。
範例:覆寫。
範例:重載。






成員類型宣告。


10. 陣列。
陣列類型。
陣列變數。
陣列創建。
陣列存取。
陣列:一個簡單的範例。
陣列初始化器。
陣列成員。
陣列的類別物件。
字元陣列不是字串。
陣列儲存例外。


11. 例外。
例外的原因。
編譯時對例外的檢查。