The Java Language Specification (Java Series) (3TH)

The Java Language Specification (Java Series) (3TH)

  • ただいまウェブストアではご注文を受け付けておりません。 ⇒古書を探す
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 651 p.
  • 言語 ENG
  • 商品コード 9780321246783
  • DDC分類 005.133

Full Description


Written by the inventors of the technology, The Java (TM) Language Specification, Third Edition, is the definitive technical reference for the Java (TM) programming language. If you want to know the precise meaning of the language's constructs, this is the source for you. The book provides complete, accurate, and detailed coverage of the Java programming language. It provides full coverage of all new features added since the previous edition, including generics, annotations, asserts, autoboxing, enums, for-each loops, variable arity methods, and static import clauses.

Table of Contents

Preface                                            xxi
Preface to the Second Edition xxv
Preface to the Third Edition xxix
Introduction 1 (8)
Example Programs 5 (1)
Notation 6 (1)
Relationship to Predefined Classes and 6 (1)
Interfaces
References 6 (3)
Grammars 9 (4)
Context-Free Grammars 9 (1)
The Lexical Grammar 9 (1)
The Syntactic Grammar 10 (1)
Grammar Notation 10 (3)
Lexical Structure 13 (20)
Unicode 13 (1)
Lexical Translations 14 (1)
Unicode Escapes 15 (1)
Line Terminators 16 (1)
Input Elements and Tokens 17 (1)
White Space 18 (1)
Comments 18 (1)
Identifiers 19 (2)
Keywords 21 (1)
Literals 21 (10)
Integer Literals 22 (2)
Floating-Point Literals 24 (2)
Boolean Literals 26 (1)
Character Literals 26 (2)
String Literals 28 (2)
Escape Sequences for Character and 30 (1)
String Literals
The Null Literal 30 (1)
Separators 31 (1)
Operators 31 (2)
Types, Values, and Variables 33 (44)
The Kinds of Types and Values 34 (1)
Primitive Types and Values 34 (10)
Integral Types and Values 35 (1)
Integer Operations 36 (1)
Floating-Point Types, Formats, and 37 (3)
Values
Floating-Point Operations 40 (3)
The boolean Type and boolean Values 43 (1)
Reference Types and Values 44 (5)
Objects 45 (2)
The Class Object 47 (1)
The Class String 48 (1)
When Reference Types Are the Same 49 (1)
Type Variables 49 (2)
Parameterized Types 51 (5)
Type Arguments and Wildcards 52 (3)
Type Argument Containment and 55 (1)
Equivalence
Members and Constructors of 55 (1)
Parameterized Types
Type Erasure 56 (1)
Reifiable Types 56 (1)
Raw Types 57 (5)
Intersection Types 62 (1)
Subtyping 63 (2)
Subtyping among Primitive Types 63 (1)
Subtyping among Class and Interface 63 (1)
Types
Subtyping among Array Types 64 (1)
Where Types Are Used 65 (2)
Variables 67 (10)
Variables of Primitive Type 67 (1)
Variables of Reference Type 67 (1)
Heap Pollution 68 (1)
Kinds of Variables 69 (2)
Final Variables 71 (1)
Initial Values of Variables 71 (2)
Types, Classes, and Interfaces 73 (4)
Conversions and Promotions 77 (36)
Kinds of Conversion 80 (13)
Identity Conversions 80 (1)
Widening Primitive Conversion 80 (2)
Narrowing Primitive Conversions 82 (2)
Widening and Narrowing Primitive 84 (1)
Conversions
Widening Reference Conversions 85 (1)
Narrowing Reference Conversions 85 (1)
Boxing Conversion 86 (2)
Unboxing Conversion 88 (1)
Unchecked Conversion 89 (1)
Capture Conversion 89 (3)
String Conversions 92 (1)
Forbidden Conversions 92 (1)
Value Set Conversion 92 (1)
Assignment Conversion 93 (6)
Method Invocation Conversion 99 (2)
String Conversion 101 (1)
Casting Conversion 101 (7)
Numeric Promotions 108 (5)
Unary Numeric Promotion 108 (2)
Binary Numeric Promotion 110 (3)
Names 113 (40)
Declarations 114 (1)
Names and Identifiers 115 (2)
Scope of a Declaration 117 (5)
Shadowing Declarations 119 (3)
Obscured Declarations 122 (1)
Members and Inheritance 122 (4)
The Members of Type Variables, 122 (1)
Parameterized Types, Raw Types and
Intersection Types
The Members of a Package 122 (1)
The Members of a Class Type 123 (1)
The Members of an Interface Type 124 (1)
The Members of an Array Type 125 (1)
Determining the Meaning of a Name 126 (12)
Syntactic Classification of a Name 127 (2)
According to Context
Reclassification of Contextually 129 (2)
Ambiguous Names
Meaning of Package Names 131 (1)
Simple Package Names 131 (1)
Qualified Package Names 132 (1)
Meaning of Package or Type Names 132 (1)
Simple Package or Type Names 132 (1)
Qualified Package or Type Names 132 (1)
Meaning of Type Names 132 (1)
Simple Type Names 132 (1)
Qualified Type Names 132 (2)
Meaning of Expression Names 134 (1)
Simple Expression Names 134 (1)
Qualified Expression Names 135 (2)
Meaning of Method Names 137 (1)
Simple Method Names 137 (1)
Qualified Method Names 137 (1)
Access Control 138 (7)
Determining Accessibility 138 (1)
Details on protected Access 139 (1)
Access to a protected Member 139 (1)
Qualified Access to a protected 140 (1)
Constructor
An Example of Access Control 140 (1)
Example: Access to public and 141 (1)
Non-public Classes
Example: Default-Access Fields, 142 (1)
Methods, and Constructors
Example: public Fields, Methods, and 143 (1)
Constructors
Example: protected Fields, Methods, and 143 (1)
Constructors
Example: private Fields, Methods, and 144 (1)
Constructors
Fully Qualified Names and Canonical Names 145 (1)
Naming Conventions 146 (7)
Package Names 147 (1)
Class and Interface Type Names 147 (1)
Type Variable Names 148 (1)
Method Names 149 (1)
Field Names 150 (1)
Constant Names 150 (1)
Local Variable and Parameter Names 151 (2)
Packages 153 (20)
Package Members 154 (1)
Host Support for Packages 155 (2)
Storing Packages in a File System 155 (2)
Storing Packages in a Database 157 (1)
Compilation Units 157 (1)
Package Declarations 158 (2)
Named Packages 158 (1)
Package Annotations 158 (1)
Unnamed Packages 159 (1)
Observability of a Package 160 (1)
Scope of a Package Declaration 160 (1)
Import Declarations 160 (6)
Single-Type-Import Declaration 161 (2)
Type-Import-on-Demand Declaration 163 (1)
Single Static Import Declaration 164 (1)
Static-Import-on-Demand Declaration 165 (1)
Automatic Imports 165 (1)
A Strange Example 165 (1)
Top Level Type Declarations 166 (3)
Unique Package Names 169 (4)
Classes 173 (86)
Class Declaration 175 (15)
Class Modifiers 175 (1)
abstract Classes 176 (2)
final Classes 178 (1)
strictfp Classes 178 (1)
Generic Classes and Type Parameters 178 (3)
Inner Classes and Enclosing Instances 181 (3)
Superclasses and Subclasses 184 (2)
Superinterfaces 186 (3)
Class Body and Member Declarations 189 (1)
Class Members 190 (6)
Examples of Inheritance 192 (1)
Example: Inheritance with Default Access 192 (1)
Inheritance with public and protected 193 (1)
Inheritance with private 193 (1)
Accessing Members of Inaccessible 194 (2)
Classes
Field Declarations 196 (13)
Field Modifiers 197 (1)
static Fields 198 (1)
final Fields 199 (1)
transient Fields 199 (1)
volatile Fields 199 (2)
Initialization of Fields 201 (1)
Initializers for Class Variables 202 (1)
Initializers for Instance Variables 202 (1)
Restrictions on the use of Fields 203 (2)
during Initialization
Examples of Field Declarations 205 (1)
Example: Hiding of Class Variables 205 (1)
Example: Hiding of Instance Variables 206 (1)
Example: Multiply Inherited Fields 207 (2)
Example: Re-inheritance of Fields 209 (1)
Method Declarations 209 (28)
Formal Parameters 210 (2)
Method Signature 212 (2)
Method Modifiers 214 (1)
abstract Methods 214 (2)
static Methods 216 (1)
final Methods 217 (1)
native Methods 218 (1)
strictfp Methods 218 (1)
synchronized Methods 218 (2)
Generic Methods 220 (1)
Method Return Type 220 (1)
Method Throws 221 (2)
Method Body 223 (1)
Inheritance, Overriding, and Hiding 224 (1)
Overriding (by Instance Methods) 224 (1)
Hiding (by Class Methods) 225 (1)
Requirements in Overriding and Hiding 225 (3)
Inheriting Methods with 228 (1)
Override-Equivalent Signatures
Overloading 229 (1)
Examples of Method Declarations 230 (1)
Example: Overriding 230 (1)
Example: Overloading, Overriding, and 231 (1)
Hiding
Example: Incorrect Overriding 231 (1)
Example: Overriding versus Hiding 232 (2)
Example: Invocation of Hidden Class 234 (1)
Methods
Large Example of Overriding 234 (2)
Example: Incorrect Overriding because 236 (1)
of Throws
Member Type Declarations 237 (1)
Modifiers 238 (1)
Static Member Type Declarations 238 (1)
Instance Initializers 238 (1)
Static Initializers 239 (1)
Constructor Declarations 240 (9)
Formal Parameters and Formal Type 240 (1)
Parameter
Constructor Signature 241 (1)
Constructor Modifiers 241 (1)
Generic Constructors 242 (1)
Constructor Throws 242 (1)
The Type of a Constructor 242 (1)
Constructor Body 242 (1)
Explicit Constructor Invocations 243 (3)
Constructor Overloading 246 (1)
Default Constructor 247 (1)
Preventing Instantiation of a Class 248 (1)
Enums 249 (10)
Interfaces 259 (28)
Interface Declarations 260 (3)
Interface Modifiers 260 (1)
abstract Interfaces 261 (1)
strictfp Interfaces 261 (1)
Generic Interfaces and Type Parameters 261 (1)
Superinterfaces and Subinterfaces 261 (2)
Interface Body and Member Declarations 263 (1)
Access to Interface Member Names 263 (1)
Interface Members 263 (1)
Field (Constant) Declarations 264 (2)
Initialization of Fields in Interfaces 265 (1)
Examples of Field Declarations 265 (1)
Ambiguous Inherited Fields 265 (1)
Multiply Inherited Fields 266 (1)
Abstract Method Declarations 266 (4)
Inheritance and Overriding 267 (1)
Overloading 268 (1)
Examples of Abstract Method Declarations 269 (1)
Example: Overriding 269 (1)
Example: Overloading 269 (1)
Member Type Declarations 270 (1)
Annotation Types 270 (11)
Predefined Annotation Types 277 (1)
Target 278 (1)
Retention 278 (1)
Inherited 279 (1)
Override 279 (1)
Suppress Warnings 280 (1)
Deprecated 280 (1)
Annotations 281 (6)
Arrays 287 (10)
Array Types 288 (1)
Array Variables 288 (1)
Array Creation 289 (1)
Array Access 289 (1)
Arrays: A Simple Example 290 (1)
Array Initializers 290 (2)
Array Members 292 (1)
Class Objects for Arrays 293 (1)
An Array of Characters is Not a String 294 (1)
Array Store Exception 294 (3)
Exceptions 297 (12)
The Causes of Exceptions 298 (1)
Compile-Time Checking of Exceptions 299 (3)
Exception Analysis of Expressions 299 (1)
Exception Analysis of Statements 300 (1)
Exception Checking 301 (1)
Why Errors are Not Checked 301 (1)
Why Runtime Exceptions are Not Checked 301 (1)
Handling of an Exception 302 (2)
Exceptions are Precise 303 (1)
Handling Asynchronous Exceptions 303 (1)
An Example of Exceptions 304 (2)
The Exception Hierarchy 306 (3)
Loading and Linkage Errors 307 (1)
Virtual Machine Errors 307 (2)
Execution 309 (24)
Virtual Machine Start-Up 309 (3)
Load the Class Test 310 (1)
Link Test: Verify, Prepare, 310 (1)
(Optionally) Resolve
Initialize Test: Execute Initializers 311 (1)
Invoke Test.main 312 (1)
Loading of Classes and Interfaces 312 (2)
The Loading Process 313 (1)
Linking of Classes and Interfaces 314 (2)
Verification of the Binary 314 (1)
Representation
Preparation of a Class or Interface Type 315 (1)
Resolution of Symbolic References 315 (1)
Initialization of Classes and Interfaces 316 (6)
When Initialization Occurs 316 (3)
Detailed Initialization Procedure 319 (2)
Initialization: Implications for Code 321 (1)
Generation
Creation of New Class Instances 322 (3)
Finalization of Class Instances 325 (5)
Implementing Finalization 326 (2)
Interaction with the Memory Model 328 (1)
Finalizer Invocations are Not Ordered 329 (1)
Unloading of Classes and Interfaces 330 (1)
Program Exit 331 (2)
Binary Compatibility 333 (26)
The Form of a Binary 334 (5)
What Binary Compatibility Is and Is Not 339 (1)
Evolution of Packages 340 (1)
Evolution of Classes 340 (16)
abstract Classes 340 (1)
final Classes 341 (1)
public Classes 341 (1)
Superclasses and Superinterfaces 341 (1)
Class Formal Type Parameters 342 (1)
Class Body and Member Declarations 343 (1)
Access to Members and Constructors 344 (1)
Field Declarations 345 (2)
final Fields and Constants 347 (2)
Static Fields 349 (1)
transient Fields 350 (1)
Method and Constructor Declarations 350 (1)
Method and Constructor Formal Type 351 (1)
Parameters
Method and Constructor Parameters 352 (1)
Method Result Type 352 (1)
abstract Methods 352 (1)
final Methods 353 (1)
native Methods 354 (1)
static Methods 354 (1)
synchronized Methods 354 (1)
Method and Constructor Throws 354 (1)
Method and Constructor Body 354 (1)
Method and Constructor Overloading 355 (1)
Method Overriding 356 (1)
Static Initializers 356 (1)
Evolution of Enums 356 (1)
Evolution of Interfaces 356 (3)
public Interfaces 356 (1)
Superinterfaces 357 (1)
The Interface Members 357 (1)
Interface Formal Type Parameters 357 (1)
Field Declarations 358 (1)
Abstract Method Declarations 358 (1)
Evolution of Annotation Types 358 (1)
Blocks and Statements 359 (50)
Normal and Abrupt Completion of Statements 360 (1)
Blocks 361 (1)
Local Class Declarations 361 (2)
Local Variable Declaration Statements 363 (5)
Local Variable Declarators and Types 364 (1)
Scope of Local Variable Declarations 364 (3)
Shadowing of Names by Local Variables 367 (1)
Execution of Local Variable Declarations 367 (1)
Statements 368 (2)
The Empty Statement 370 (1)
Labeled Statements 370 (1)
Expression Statements 371 (1)
The if Statement 372 (1)
The if-then Statement 372 (1)
The if-then-else Statement 372 (1)
The assert Statement 373 (4)
The switch Statement 377 (3)
The while Statement 380 (2)
Abrupt Completion 381 (1)
The do Statement 382 (2)
Abrupt Completion 383 (1)
Example of do statement 383 (1)
The for Statement 384 (4)
The basic for Statement 384 (1)
Initialization of for statement 385 (1)
Iteration of for statement 385 (1)
Abrupt Completion of for statement 386 (1)
The enhanced for statement 387 (1)
The break Statement 388 (2)
The continue Statement 390 (2)
The return Statement 392 (1)
The throw Statement 393 (2)
The synchronized Statement 395 (1)
The try statement 396 (6)
Execution of try-catch 398 (1)
Execution of try-catch-finally 399 (3)
Unreachable Statements 402 (7)
Expressions 409 (118)
Evaluation, Denotation, and Result 409 (1)
Variables as Values 410 (1)
Type of an Expression 410 (1)
FP-strict Expressions 411 (1)
Expressions and Run-Time Checks 411 (2)
Normal and Abrupt Completion of Evaluation 413 (1)
Evaluation Order 414 (6)
Evaluate Left-Hand Operand First 415 (1)
Evaluate Operands before Operation 416 (1)
Evaluation Respects Parentheses and 417 (1)
Precedence
Argument Lists are Evaluated 418 (1)
Left-to-Right
Evaluation Order for Other Expressions 419 (1)
Primary Expressions 420 (3)
Lexical Literals 420 (1)
Class Literals 421 (1)
this 421 (1)
Qualified this 422 (1)
Parenthesized Expressions 422 (1)
Class Instance Creation Expressions 423 (8)
Determining the Class being Instantiated 424 (1)
Determining Enclosing Instances 425 (2)
Choosing the Constructor and its 427 (1)
Arguments
Run-time Evaluation of Class Instance 428 (1)
Creation Expressions
Anonymous Class Declarations 429 (1)
Anonymous Constructors 429 (1)
Example: Evaluation Order and 430 (1)
Out-of-Memory Detection
Array Creation Expressions 431 (4)
Run-time Evaluation of Array Creation 432 (1)
Expressions
Example: Array Creation Evaluation Order 433 (1)
Example: Array Creation and 434 (1)
Out-of-Memory Detection
Field Access Expressions 435 (5)
Field Access Using a Primary 435 (3)
Accessing Superclass Members using super 438 (2)
Method Invocation Expressions 440 (42)
Compile-Time Step 1: Determine Class or 440 (2)
Interface to Search
Compile-Time Step 2: Determine Method 442 (1)
Signature
Identify Potentially Applicable Methods 443 (2)
Phase 1: Identify Matching Arity 445 (1)
Methods Applicable by Subtyping
Phase 2: Identify Matching Arity 446 (1)
Methods Applicable by Method Invocation
Conversion
Phase 3: Identify Applicable Variable 446 (1)
Arity Methods
Choosing the Most Specific Method 447 (3)
Method Result and Throws Types 450 (1)
Inferring Type Arguments Based on 451 (15)
Actual Arguments
Inferring Unresolved Type Arguments 466 (1)
Examples 466 (2)
Example: Overloading Ambiguity 468 (1)
Example: Return Type Not Considered 468 (1)
Example: Compile-Time Resolution 469 (2)
Compile-Time Step 3: Is the Chosen 471 (2)
Method Appropriate?
Runtime Evaluation of Method Invocation 473 (1)
Compute Target Reference (If Necessary) 473 (1)
Evaluate Arguments 474 (1)
Check Accessibility of Type and Method 475 (1)
Locate Method to Invoke 476 (1)
Create Frame, Synchronize, Transfer 477 (2)
Control
Example: Target Reference and Static 479 (1)
Methods
Example: Evaluation Order 479 (1)
Example: Overriding 480 (1)
Example: Method Invocation using super 481 (1)
Array Access Expressions 482 (3)
Runtime Evaluation of Array Access 483 (1)
Examples: Array Access Evaluation Order 483 (2)
Postfix Expressions 485 (2)
Expression Names 485 (1)
Postfix Increment Operator ++ 485 (1)
Postfix Decrement Operator -- 486 (1)
Unary Operators 487 (3)
Prefix Increment Operator ++ 487 (1)
Prefix Decrement Operator -- 488 (1)
Unary Plus Operator + 489 (1)
Unary Minus Operator -- 489 (1)
Bitwise Complement Operator ‾ 490 (1)
Logical Complement Operator ! 490 (1)
Cast Expressions 490 (1)
Multiplicative Operators 491 (5)
Multiplication Operator * 492 (1)
Division Operator / 493 (2)
Remainder Operator % 495 (1)
Additive Operators 496 (6)
String Concatenation Operator + 497 (1)
String Conversion 497 (1)
Optimization of String Concatenation 498 (1)
Examples of String Concatenation 498 (2)
Additive Operators (+ and -) for 500 (2)
Numeric Types
Shift Operators 502 (1)
Relational Operators 503 (2)
Numerical Comparison Operators <, 503 (1)
<=, >, and >=
Type Comparison Operator instanceof 504 (1)
Equality Operators 505 (3)
Numerical Equality Operators == and != 506 (1)
Boolean Equality Operators == and != 507 (1)
Reference Equality Operators == and != 507 (1)
Bitwise and Logical Operators 508 (1)
Integer Bitwise Operators &, ^, and | 508 (1)
Boolean Logical Operators &, ^, and | 508 (1)
Conditional-And Operator && 509 (1)
Conditional-Or Operator || 509 (1)
Conditional Operator ? : 510 (2)
Assignment Operators 512 (13)
Simple Assignment Operator = 513 (5)
Compound Assignment Operators 518 (7)
Expression 525 (1)
Constant Expression 525 (2)
Definite Assignment 527 (26)
Definite Assignment and Expressions 533 (5)
Boolean Constant Expressions 533 (1)
The Boolean Operator && 533 (1)
The Boolean Operator II 534 (1)
The Boolean Operator ! 534 (1)
The Boolean Operator ? : 534 (1)
The Conditional Operator ? : 535 (1)
Other Expressions of Type boolean 535 (1)
Assignment Expressions 535 (1)
Operators ++ and -- 536 (1)
Other Expressions 536 (2)
Definite Assignment and Statements 538 (9)
Empty Statements 538 (1)
Blocks 538 (1)
Local Class Declaration Statements 539 (1)
Local Variable Declaration Statements 539 (1)
Labeled Statements 540 (1)
Expression Statements 540 (1)
If Statements 541 (1)
assert Statements 541 (1)
switch Statements 541 (1)
while Statements 542 (1)
do Statements 543 (1)
for Statements 543 (1)
Initialization Part 544 (1)
Incrementation Part 544 (1)
break, continue, return, and throw 545 (1)
Statements
synchronized Statements 545 (1)
try Statements 545 (2)
Definite Assignment and Parameters 547 (1)
Definite Assignment and Array Initializers 547 (1)
Definite Assignment and Enum Constants 548 (1)
Definite Assignment and Anonymous Classes 548 (1)
Definite Assignment and Member Types 549 (1)
Definite Assignment and Static 549 (1)
Initializers
Definite Assignment, Constructors, and 550 (3)
Instance Initializers
Threads and Locks 553 (32)
Locks 554 (1)
Notation in Examples 554 (1)
Incorrectly Synchronized Programs Exhibit 555 (2)
Surprising Behaviors
Memory Model 557 (16)
Shared Variables 558 (1)
Actions 558 (2)
Programs and Program Order 560 (1)
Synchronization Order 561 (1)
Happens-before Order 561 (6)
Executions 567 (1)
Well-Formed Executions 568 (1)
Executions and Causality Requirements 568 (3)
Observable Behavior and Nonterminating 571 (2)
Executions
Final Field Semantics 573 (5)
Semantics of Final Fields 575 (1)
Reading Final Fields During Construction 576 (1)
Subsequent Modification of Final Fields 576 (2)
Write Protected Fields 578 (1)
Word Tearing 578 (1)
Non-atomic Treatment of double and long 579 (1)
Wait Sets and Notification 580 (3)
Wait 580 (1)
Notification 581 (1)
Interruptions 582 (1)
Interactions of Waits, Notification and 582 (1)
Interruption
Sleep and Yield 583 (2)
Syntax 585 (12)
The Grammar of the Java Programming 585 (12)
Language
Index 597 (52)
Credits 649 (2)
Colophon 651