没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
The Java
®
Language
Specification
Java SE 15 Edition
James Gosling
Bill Joy
Guy Steele
Gilad Bracha
Alex Buckley
Daniel Smith
Gavin Bierman
2020-08-10
Specification: JSR-390 Java SE 15
Version: 15
Status: Final Release
Release: September 2020
Copyright © 1997, 2020, Oracle America, Inc.
All rights reserved.
The Specification provided herein is provided to you only under the Limited License Grant
included herein as Appendix A. Please see Appendix A, Limited License Grant.
Table of Contents
1
Introduction 1
1.1 Organization of the Specification 2
1.2 Example Programs 6
1.3 Notation 6
1.4 Relationship to Predefined Classes and Interfaces 7
1.5 Preview Features 7
1.6 Feedback 8
1.7 References 8
2
Grammars 11
2.1 Context-Free Grammars 11
2.2 The Lexical Grammar 11
2.3 The Syntactic Grammar 12
2.4 Grammar Notation 12
3
Lexical Structure 17
3.1 Unicode 17
3.2 Lexical Translations 18
3.3 Unicode Escapes 19
3.4 Line Terminators 21
3.5 Input Elements and Tokens 21
3.6 White Space 23
3.7 Comments 23
3.8 Identifiers 24
3.9 Keywords 26
3.10 Literals 28
3.10.1 Integer Literals 28
3.10.2 Floating-Point Literals 35
3.10.3 Boolean Literals 38
3.10.4 Character Literals 39
3.10.5 String Literals 40
3.10.6 Text Blocks 42
3.10.7 Escape Sequences 48
3.10.8 The Null Literal 49
3.11 Separators 49
3.12 Operators 49
4
Types, Values, and Variables 51
4.1 The Kinds of Types and Values 51
iii
The Java
®
Language Specification
4.2 Primitive Types and Values 52
4.2.1 Integral Types and Values 53
4.2.2 Integer Operations 53
4.2.3 Floating-Point Types, Formats, and Values 55
4.2.4 Floating-Point Operations 58
4.2.5 The boolean Type and boolean Values 62
4.3 Reference Types and Values 63
4.3.1 Objects 64
4.3.2 The Class Object 67
4.3.3 The Class String 67
4.3.4 When Reference Types Are the Same 68
4.4 Type Variables 68
4.5 Parameterized Types 70
4.5.1 Type Arguments of Parameterized Types 71
4.5.2 Members and Constructors of Parameterized Types 74
4.6 Type Erasure 75
4.7 Reifiable Types 76
4.8 Raw Types 77
4.9 Intersection Types 81
4.10 Subtyping 82
4.10.1 Subtyping among Primitive Types 82
4.10.2 Subtyping among Class and Interface Types 83
4.10.3 Subtyping among Array Types 84
4.10.4 Least Upper Bound 84
4.10.5 Type Projections 87
4.11 Where Types Are Used 89
4.12 Variables 94
4.12.1 Variables of Primitive Type 95
4.12.2 Variables of Reference Type 95
4.12.3 Kinds of Variables 97
4.12.4 final Variables 99
4.12.5 Initial Values of Variables 101
4.12.6 Types, Classes, and Interfaces 102
5
Conversions and Contexts 105
5.1 Kinds of Conversion 108
5.1.1 Identity Conversion 108
5.1.2 Widening Primitive Conversion 108
5.1.3 Narrowing Primitive Conversion 110
5.1.4 Widening and Narrowing Primitive Conversion 113
5.1.5 Widening Reference Conversion 113
5.1.6 Narrowing Reference Conversion 113
5.1.6.1 Allowed Narrowing Reference Conversion 114
5.1.6.2 Checked and Unchecked Narrowing Reference
Conversions 115
5.1.6.3 Narrowing Reference Conversions at Run Time 116
5.1.7 Boxing Conversion 119
iv
The Java
®
Language Specification
5.1.8 Unboxing Conversion 120
5.1.9 Unchecked Conversion 122
5.1.10 Capture Conversion 122
5.1.11 String Conversion 124
5.1.12 Forbidden Conversions 125
5.1.13 Value Set Conversion 125
5.2 Assignment Contexts 126
5.3 Invocation Contexts 131
5.4 String Contexts 133
5.5 Casting Contexts 133
5.6 Numeric Contexts 140
6
Names 145
6.1 Declarations 146
6.2 Names and Identifiers 154
6.3 Scope of a Declaration 156
6.4 Shadowing and Obscuring 159
6.4.1 Shadowing 161
6.4.2 Obscuring 164
6.5 Determining the Meaning of a Name 165
6.5.1 Syntactic Classification of a Name According to Context 167
6.5.2 Reclassification of Contextually Ambiguous Names 170
6.5.3 Meaning of Module Names and Package Names 172
6.5.3.1 Simple Package Names 172
6.5.3.2 Qualified Package Names 172
6.5.4 Meaning of PackageOrTypeNames 173
6.5.4.1 Simple PackageOrTypeNames 173
6.5.4.2 Qualified PackageOrTypeNames 173
6.5.5 Meaning of Type Names 173
6.5.5.1 Simple Type Names 173
6.5.5.2 Qualified Type Names 173
6.5.6 Meaning of Expression Names 174
6.5.6.1 Simple Expression Names 174
6.5.6.2 Qualified Expression Names 175
6.5.7 Meaning of Method Names 178
6.5.7.1 Simple Method Names 178
6.6 Access Control 179
6.6.1 Determining Accessibility 180
6.6.2 Details on protected Access 184
6.6.2.1 Access to a protected Member 185
6.6.2.2 Access to a protected Constructor 185
6.7 Fully Qualified Names and Canonical Names 187
7
Packages and Modules 191
7.1 Package Members 192
7.2 Host Support for Modules and Packages 193
7.3 Compilation Units 196
v
剩余805页未读,继续阅读
资源评论
zh168jin
- 粉丝: 1
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功