Java中true,false到底是不是关键字 不是!

Oracle java8语言规范:

The keywords const and goto are reserved, even though they are not currently used.
This may allow a Java compiler to produce better error messages if these C++ keywords incorrectly appear in programs.
While true and false might appear to be keywords, they are technically boolean literals(§3.10.3). 
Similarly, while null might appear to be a keyword, it is technically the null literal (§3.10.7).

true,false属于布尔类型的字面值。

Java关键字:

abstract
boolean
break
byte
case
catch
char
class
const+
continue
default
do
double
else
extends
final
finally
float
for
goto+
if
implements
import
instanceof
int
interface
long
native
new
package
private
protected
public
return
short
static
super
switch
synchronized
this
throw
throws
transient
try
void
volatile
while

你可能感兴趣的:(Java)