Is there any way static block is executed more than once? if so then how?

Posted by learner on Stack Overflow See other posts from Stack Overflow or by learner
Published on 2010-05-20T06:39:10Z Indexed on 2010/05/20 6:40 UTC
Read the original article Hit count: 148

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about java

Related posts about classloader