在Java 5中,enum已经成为了关键字,因此不能再用于变量名。 目前的java编译器会在编译使用enum命名的变量时抛出错误。
enum
如下代码演示了这个规则:
public void doSomething() { int enum = 42; // Non-Compliant }