java中的关键字

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网页复制的,可以参考!

Java Language Keywords

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.

abstractcontinuefornewswitch
assert***defaultgoto*packagesynchronized
booleandoifprivatethis
breakdoubleimplementsprotectedthrow
byteelseimportpublicthrows
caseenum****instanceofreturntransient
catchextendsintshorttry
charfinalinterfacestaticvoid
classfinallylongstrictfp**volatile
const*floatnativesuperwhile
* not used
** added in 1.2
*** added in 1.4
**** added in 5.0

转载于:https://www.cnblogs.com/zfy-220/p/4285690.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值