為了方便我直接復制過來了,原文如下:
Here's a list of keywords in the Java programming language.
下面是Java編程語言的關鍵字列表。
You cannot use any of the following as identifiers in your programs.
你不能使用下列任何一個單詞做程序標識符。
The keywords const and goto are reserved, even though they are not currently used.
關鍵字const和goto語句是保留的,雖然他們目前沒有使用。
true, false, and null might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs.
true,false,和null看起來是關鍵字,但它們實際上是字面值;你不能用它們作為程序標識符。
abstract |
continue |
for |
new |
switch |
assert*** |
default |
goto* |
package |
synchronized |
boolean |
do |
if |
private |
this |
break |
double |
implements |
protected |
throw |
byte |
else |
import |
public |
throws |
case |
enum**** |
instanceof |
return |
transient |
catch |
extends |
int |
short |
try |
char |
final |
interface |
static |
void |
class |
finally |
long |
strictfp** |
volatile |
const* |
float |
native |
super |
while |
* |
|
not used |
** |
|
added in 1.2 |
*** |
|
added in 1.4 |
**** |
|
added in 5.0 |
訪問控制
- private 私有的
- protected 受保護的
- public 公共的
類、方法、變量の修飾符
- abstract 聲明抽象
- class 類
- extends 擴允,繼承
- final 終極,不可改變的
- implements實現
- interface 接口
- native 本地
- new 新,創建
- static 靜態
- strictfp 嚴格,精准
- synchronized 線程,同步
- transient 短暫
- volatile 易失
- const
- assert
程序控制語句
- break 跳出循環
- continue 繼續
- return 返回
- do 運行
- while 循環
- if 如果
- else 反之
- for 循環
- instanceof 實例
- switch 開關
- case 返回開關里的結果
- default 默認
- goto
錯誤處理
- catch 處理異常
- finally 有沒有異常都執行
- throw 拋出一個異常對象
- throws 聲明一個異常可能被拋出
- try 捕獲異常
包相關
- import 引入
- package 包
基本類型
- boolean 布爾型
- byte 字節型
- char 字符型
- double 雙精度,
- float 浮點
- int 整型
- long 長整型
- short 短整型
變量引用
- super 父類,超類
- this 本類
- void 無返回值
- enum 枚舉類型
共有:3+15+13+5+2+8+4=50個關鍵字,全部是小寫
結論:
- const、goto 是關鍵字,雖然沒用,但不能拿來當變量名
- true、false、null 不是關鍵字,但也不能用來當變量名
- friendly、sizeof 不是關鍵字,可以用來當變量名