修复代码运行报错
This commit is contained in:
parent
9aebc4660f
commit
bd7d42b516
|
@ -211,14 +211,13 @@ public enum EnumSingleton {
|
|||
|
||||
// 反射获取实例测试
|
||||
try {
|
||||
Constructor<EnumSingleton> constructor = EnumSingleton.class.getDeclaredConstructor();
|
||||
constructor.setAccessible(true);
|
||||
EnumSingleton enumSingleton = constructor.newInstance();
|
||||
System.out.println(enumSingleton.getObjName());
|
||||
EnumSingleton[] enumConstants = EnumSingleton.class.getEnumConstants();
|
||||
for (EnumSingleton enumConstant : enumConstants) {
|
||||
System.out.println(enumConstant.getObjName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user