Is there any way static block is executed more than once? if so then how?
- by learner
My Understanding
Static block is executed during class loading, If a class is already loaded then there is no way to load the class other than class reloading
Doubt/Question
1) Is there any time JVM reloads the class?
My Understanding
In Class Loading JVM loads source of the Java file, so it can not keep all thousands files source is a memory, it should discard the rarely used code and reload again when it is necessary and during reload JVM is not initializing static variables and locks again(may be using some tracking mechanism)
Doubt/Question
2) If my above understanding is incorrect then please correct me