双语版Java程序设计
上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人

2.8 Keywords

Keywords cannot be used for anything but their predefined purpose. There are 49 in all, These words each have a special meaning to the Java compiler. A keyword must be separated from other keywords or identifiers by white space, a comment or some other punctuation symbol.

The keywords const and goto have no meaning in Java but are included as keywords to facilitate error reporting. These are keywords in C++, a language that many Java programmers will have learned before learning Java.

关键字只能使用在预定义部分,关键字和保留字之间需要用一个空格分隔开。

In addition the symbols true and false may appear to be keywords because they cannot be used as identifiers, they are in fact boolean literals. Table 2.1 lists main keywords in Java:

Table 2.1 keywords in Java