Java 關鍵字列表 (依字母排序 共51組),所有的關鍵字都是小寫,在MyEclipse中都會顯示不同的顏色:
abstract, assert,boolean, break, byte, case, catch, char, class, const, continue, default, do, double, else, enum,extends, final, finally, float, for, if,
implements, import, instanceof, int, interface, long, native, new, package, private, protected, public, return, short, static, strictfp, super, switch,
synchronized, this, throw, throws, transient, try, void, volatile, while
用於類的接口聲明:class extends implements interface
包引入和包聲明:import package
數據類型:boolean byte char short int long float double
某些數據類型的可先值:false true null
流程控制:break case continue default for do while if else return switch
異常處理:catch finally throw throws try
修飾符:abstract final native private protected public static synchronized transient volatile
操作符:instanceof
創建對象:new
引用:this super
方法返回類型:void
Java 保留字列表 (依字母排序 共14組) :
byValue, cast, false, future, generic, inner, operator, outer, rest, true, var , goto ,const,null
總結:
正確識別java語言的關鍵字(keyword)和保留字(reserved word)是十分重要的。Java的關鍵字對java的編譯器有特殊的意義,他們用來表示一種數據類型,或者表示程序的結
構等。保留字是爲java預留的關鍵字,他們雖然現在沒有作爲關鍵字,但在以後的升級版本中有可能作爲關鍵字
注,不能使用Java中的關鍵字來做爲類、變量、方法的名字。但是有些保留字是可以作爲變量的。比如var...
Java標示符
標示符是指定程序中的包、類、接口、變量或方法的名字,只能以字母、下劃線“_”、美元“$”、或中文字符開頭,還可以包含數字。標示符沒有長度限制。