Application introduction of Java class variable and member variable initialization process

1、 Class initialization

For class initialization: class initialization is generally only initialized once. Class initialization is mainly to initialize static member variables.

The compilation of a class determines the initialization process of a class.

The class file generated by the compiler mainly makes the following changes to the classes defined in the source file:

1) First, declare member variables inside the class in the order in which static member variables are defined.

2) Then initialize according to the initialization order of member variables in the original Java class.

The corresponding conversion between a Java class and the compiled class is as follows:

Source file:

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