下面列出 Java 全部保留字,这些保留字不能用于常量、变量和任何标识符的名称。
private(私有的)、protected(受保护的)、public(公共的)、default(默认)abstract(声明抽象)、class(类)、extends(继承)、final(最终值、不可改变)、implements(实现接口)、interface(接口)、native(本地方法)、new(创建)、static(静态)、strictfp(严格浮点)、synchronized(线程同步)、transient(短暂)、volatile(易失)break、case、continue、do、else、for、if、instanceof、return、switch、whileassert(断言)、catch(捕捉异常)、finally(有无异常都执行)、throw(抛出异常对象)、throws(声明可能抛出的异常)、try(捕获异常)import(引入)、package(包)boolean、byte、char、double、float、int、long、shortsuper(父类、超类)、this(本类)、void(无返回值)goto 和 const 是保留关键字,但完全不能使用。true 和 false,是一个字面常量,同样不允许作为标识符使用。