What is the purpose of static block and what does it mean?
posted 10 years ago
You're probably familiar with how static variables are initialized the first time you reference a class (when the class is loaded). Static blocks are executed at the same time. That gives you a neat way to do a little more work than a single initial value. For example:
We could even move all those states into a static method and call it from the static block. Neat, huh?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi