JDBC driver, for example, use static blocks to register themselves to the DriverManager. That's why loading a JDBC driver by Class.forName initializes it.
Another use is to initialize complex static variables, such as Collections etc.
They shouldn't be used too often, though - most often there are better (more flexible) alternatives to static blocks.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Just wanted to add that a static block is executed when the class is first loaded & initialized for use. The JVM spec has more accurate definitions about this, but usually you'll notice that a class is loaded & initialized when you first use it - e.g. when you first try to create an instance, or use some static methods/variables.
To add to Naveen Question, what all resolutions happen at compile time and what all are left for run time.
can someone pls point me to appropriate resource
~ Pratibha Malhotra<br /> <br />Sun Certified Java Programmer<br />SCEA 1.4 (In Progress)<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />"Many of life's failures are people who did not realize how close they were to success when they gave up!!"
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com