Hi...
I m practising fundametals on Java.
As said in many books, static block is supposed to execute when the class is loaded. I've two classes.

class TestStatic // static block declared in this class
public class ShellMain // contains Main Thread

In class TestStatic, following variable is declared
Code:
static final int i = 10;
and then execute from Main Thread using
Code:
System.out.println("Static i is: " +  TestStatic.i);
which gives result
Code:
Static i is: 10
Plz note that static block is not executed.
But if i remove final keyword , static block is executed.
Is there some hidden concept related with a variable declared with final and static keyword togethar??
Static block is executed properly, if any method is call is given, even while 'variable i' is declared with static final keywords.
Following is the code for your review:-
Code:
class TestStatic {
	static final int i = 10;
	static void callThis() {
		System.out.println("Inside static method [callThis]");
	}

	static {
		System.out.println("Inside Static Block");
	}

	void callThis(int x) {
		System.out.println("Inside Overload [callThis]: " + x);
	}

}
//-------------------------------------
//I use various ways to make the static block execute.
public class ShellMain {
	public static void main(String[] args) {
		//TestStatic.callThis();
		//new TestStatic().callThis(10); //if i exceute this call it works fine.
		System.out.println("Static i is: " +  TestStatic.i);
	}

}