我的猜测是< clinit>在< init>之前调用方法.任何身体能给我一些信息来证明吗?这是否记录在JVM规范或Java语言规范中?
解决方法
A class or interface has at most one class or interface initialization method and is initialized (§5.5) by invoking that method. The initialization method of a class or interface has the special name
<clinit>
,takes no arguments,and is void (§4.3.3).The name
<clinit>
is supplied by a compiler. Because the name is not a valid identifier,it cannot be used directly in a program written in the Java programming language. Class and interface initialization methods are invoked implicitly by the Java Virtual Machine; they are never invoked directly from any Java Virtual Machine instruction,but are invoked only indirectly as part of the class initialization process.
有关类初始化过程的更多详细信息,请参阅Chapter 5.