Java – why can’t you call a super constructor from an enumeration constructor?
•
Java
public enum A {
public enum A { A(1); private A(int i){ } private A(){ super(); // compile - error // Cannot invoke super constructor from enum constructor A() } }
Here is the enumeration hierarchy a from abstract Java Lang. enum extension 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());
Solution
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.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码