Java – who calls the class initializer method and when?

I know that the new DUP, invocation and astere bytecode patterns will call the instance initialization method < init > when someone instantiates a Java class from the perspective of the Java language, but I never know who called the special < clinit > method and when this happened?

My guess is that < clinit> calls the method before < init>. Can any body give me some information to prove it? Is this documented in the JVM specification or the Java language specification?

Solution

JVM specification § 2.9 Special Methods:

For more details on the class initialization process, see Chapter 5

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
分享
二维码
< <上一篇
下一篇>>