具有专门的意义和用途,不能被当作一般的标识符使用的标识符称为保留字(reserved word),也称为关键字。保留字不能用来命名类、方法或变量。
补充:
Java语言有51个保留关键字,其中const和goto虽然被保留但未被使用。这51个关键字分别为:
1、数据类型类10个:
Boolean int long short byte float double char class interface
2、流程控制类14个:
if else do while for switch case default break continue return try catch finally
3、修饰符类12个:
public protected private final void static strictfp abstract transient
synchronized volatile native
4、动作类10个:
package import throw throws extends implements this Super instanceof new
5、保留字类5个:
true false null goto const