() The difference between Java in the init method and clinit () method

1.init () and clinit () method performs a different time. init is the object constructor method , only the init method of performing a new object program call the constructor of the object class. Clinit is the class constructor method , performed in the JVM class loader - verification - Analytical - initialization, the JVM calls the initialization phase clinit method.

2.init () and the clinit () method performs different purposes. init is an instance constructor instance, non-static variable parsing initialization. And clinit class is class constructor, the static variables are initialized and the static block of code.

Published 62 original articles · won praise 34 · views 40000 +

Guess you like

Origin blog.csdn.net/qq_42451835/article/details/104221531