本文比较一下Java和Scala语言的关键字
Java关键字
Java一共有50个关键字(keywords),其中有2个是保留字,目前还不曾用到:goto和const。true、false和null看起来很像关键字,但实际上只是字面量而已。本文粗略的把true、false和null也看做Java关键字,认为Java一共有53个关键字。下面是大致归类的Java关键字列表:
- assert
- boolean, byte, short, char, int, long, float, double, void
- package, import, class, interface, enum, implements, extends
- public, protected, private, abstract, static, final, volatile, transient, synchronized, strictfp, native
- try, catch, finally, throw, throws
- if, else, do, while, for, switch, case, default, break, continue, return
- super, this
- new, instanceof
- c