I searched for a long time but couldn’t find the execution time of the block. Later, I used javap -c to check the class file and found that the block was thrown into the constructor, and the <init> method of invokespecial superclass was also in it, but it was in front of the block, so this Explained your problem.
First of all, after using the javac command to compile a java class, the initialization code block of the java class will disappear - the code in the initialization code block will be "restored" to each constructor and will be located in front of all the code in the constructor.
I searched for a long time but couldn’t find the execution time of the block. Later, I used javap -c to check the class file and found that the block was thrown into the constructor, and the <init> method of invokespecial superclass was also in it, but it was in front of the block, so this Explained your problem.
First of all, after using the javac command to compile a java class, the initialization code block of the java class will disappear - the code in the initialization code block will be "restored" to each constructor and will be located in front of all the code in the constructor.
Basic process:
You can analyze it yourself.