标签:
7、以下不是java关键字的有【C】 。
A. super B. this C. NULL D. true
正确答案是CD,今天做了一个简单的java测试题结果让我凌乱了,用了这么长时间的java,一直以为true也是java的关键字,因为用任何编辑工具里面true,false,null都是会变色的,结果今天才发现java里面认为true,false,null不是一个关键字,而是 literals字面值。这也是前sun公司规定的,没有原因,既然要玩java这个游戏就需要遵守人家的规定!
下面是从http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html网页复制的,可以参考!
Here is a list of keywords in the Java programming language. You cannot use any of the following as identifiers in your programs. The keywords const
and goto
are reserved, even though they are not currently used. true
, false
, and null
might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs.
abstract |
continue |
for |
new |
switch |
assert *** |
default |
goto * |
package |
synchronized |
boolean |
do |
if |
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 |
* | not used | |
** | added in 1.2 | |
*** | added in 1.4 | |
**** | added in 5.0 |
标签:
原文地址:http://www.cnblogs.com/zfy-220/p/4285690.html