JAVA一共有51个关键字 如下 abstract assert boolean break byte continue case catch char class const double default do extends else final float for goto long if implements import native new null instanceof int interface package private protected public return short static strictfp super switch synchronized this while void throw throws transient try volatile
楼上的数错了吧,那只有 49 个!就已经发布的 JDK 来说,Java 中的关键词有 50 个: abstract continue for new switch assert default if package synchronized boolean do goto 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另外,true, false 和 null 不属于关键词!尽管 true 和 false 看上去可能像是关键词,但他们不是,他们只是 boolean 类型的值。类似的,null 表示的是空值。
对比了一下,少了 enum 和 finally,多了 null,呵呵 ^_^
abstract assert boolean break byte continue case catch char class const double default do extends else final float for goto long if implements import native new null instanceof int interface package private protected public return short static strictfp super switch synchronized this while void throw throws transient try volatile
java 的关键字有51个abstract assert boolean break byte continue case catch char class const double default do extends else final float for goto long if implements import native new null instanceof int interface package private protected public return short static strictfp super switch synchronized this while void throw throws transient try volatile
abstract assert boolean break byte continue
case catch char class const double
default do extends else final float
for goto long if implements import
native new null instanceof int interface
package private protected public return short
static strictfp super switch synchronized this
while void throw throws transient try
volatile
abstract continue for new switch
assert default if package synchronized
boolean do goto 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另外,true, false 和 null 不属于关键词!尽管 true 和 false 看上去可能像是关键词,但他们不是,他们只是 boolean
类型的值。类似的,null 表示的是空值。
对比了一下,少了 enum 和 finally,多了 null,呵呵 ^_^
assert
boolean
break
byte
continue
case
catch
char
class
const
double
default
do
extends
else
final
float
for
goto
long
if
implements
import
native
new
null
instanceof
int
interface
package
private
protected
public
return
short
static
strictfp
super
switch
synchronized
this
while
void
throw
throws
transient
try
volatile
case catch char class const double
default do extends else final float
for goto long if implements import
native new null instanceof int interface
package private protected public return short
static strictfp super switch synchronized this
while void throw throws transient try
volatile