Java编程语言中有一些保留的关键字,不能作为标识符,因为他们对于编译器而言具有特殊含义。由于关键字在Java中所发挥的特定功能,因此大多数Java IDE会使用各种颜色着中显示这些关键字,以便程序员一目了然。
Java的50个关键字如下:
abstract assert boolean break bytecase catch char class constcontinue default do double elseenum extends final finally floatfor goto if implements importinstanceof int interface long nativenew package private protected publicreturn short static strictfp superswitch synchronized this throw throwstransient try void volatile while
关于Java关键字有下列几点重点指出,
- constc的和goto两个关键词并没有使用
- 所有的关键词都是小写字母
- true false null是字面量,不是关键字。
