|
|
|
|
|
|
The following fifty keywords are reserved for use by the Java language:
abstract
assert
boolean
break
byte
case
catch
char
class
const
continue
default
do
double
else
enum
extends
for
final
finally
float
goto
if
implements
import
instanceof
int
interface
long
native
new
package
private
protected
public
return
short
static
strictfp [*]
[*] The strictfp keyword is a modifier for method or class to use strict floating-point calculations. Floating-point arithmetic can be executed in one of two modes: strict or nonstrict . The strict mode guarantees that the evaluation result is the same on all Java Virtual Machine implementations . The nonstrict mode allows intermediate results from calculations to be stored in an extended format different from the standard IEEE floating-point number format. The extended format is machine-dependent and enables code to be executed faster. However, when you execute the code using the nonstrict mode on different JVMs, you may not always get precisely the same results. By default, the nonstrict mode is used for floating-point calculations. To use the strict mode in a method or a class, add the strictfp keyword in the method or the class declaration. Strict floating-point may give you slightly better precision than nonstrict floating-point, but the distinction will only affect some applications. Strictness is not inherited; that is, the presence of strictfp on a class or interface declaration does not cause extended classes or interfaces to be strict.
super
switch
synchronized
this
throw
throws
transient
try
void
volatile
while
The keywords goto and const are C++ keywords reserved, but not currently used, in Java. This enables Java compilers to identify them and to produce better error messages if they appear in Java programs.
The literal values true , false , and null are not keywords, just like literal value 100 . However, you cannot use them as identifiers, just as you cannot use 100 as an identifier.
assert is a keyword added in JDK 1.4 and enum is a keyword added in JDK 1.5.