为什么编译下面的代码会导致错误?
public class Test {
public static void main(String[] args) {
TestEnum.INSTANCE.run();
}
}
enum TestEnum implements Runnable {
INSTANCE {
@Override public void run() {}
};
}
$ javac Test.java
Test.java:3: cannot find symbol
symbol : method run()
location: class TestEnum
TestEnum.INSTANCE.run();
^