java – 为什么不能从枚举构造函数调用超级构造函数?
发布时间:2020-12-14 16:26:38 所属栏目:Java 来源:网络整理
导读:public enum A { A(1); private A(int i){ } private A(){ super(); // compile - error // Cannot invoke super constructor from enum constructor A() }} 这里是枚举的层次结构A从抽象java.lang.Enum扩展java.lang.Object Class c = Class.forName("/*pat
public enum A { A(1); private A(int i){ } private A(){ super(); // compile - error // Cannot invoke super constructor from enum constructor A() } } 这里是枚举的层次结构A从抽象java.lang.Enum扩展java.lang.Object Class c = Class.forName("/*path*/.A"); System.out.println(c.getSuperclass().getName()); System.out.println(Modifier.toString(c.getSuperclass().getModifiers()).contains("abstract")); System.out.println(c.getSuperclass().getSuperclass().getName()); 解决方法
502. That’s an error. The server encountered a temporary error and could not complete your request. Please try again in 30 seconds. That’s all we know. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |