更新时间:2022-05-12 02:05:57
其实你可以做一个静态导入。下面的代码编译好:
Actually, you can do a static import of a nested enum. The code below compiles fine:
package mypackage;
import static mypackage.Test.MyEnum.*;
public class Test
{
enum MyEnum{E1, E2};
public static void aTestMethod() {
Test2(E1);
}
public static void Test2(MyEnum e) {}
}