Thanks Ankit for your reply.As i have mentioned earlier,that i went through the other threads in this forum on this particular topic,eventually following the links, i went to JLS as well. However, Mr. Wong wonderfully summarized it in these few points-
1. declared as final
2. have a primative or
String type
3. initialized (on the same line as the declaration)
4. assigned to a compile time constant expression
I understand that part,that is not my question. If i was passing the value through a method call to the variable, or if i used any expressions other than the ones mentioned in JLS,i would have agreed that it is run-time constant.
But my question is how " final int i=1" and "final int i; i=1;" these are different in terms of assigning the values? How come they are assigning the same value differently? i just want to know what happens when i compile and run these two lines,at what phase variables are initialized. Because unless that doubt is not cleared, i am failing to understand why the second expression does not qualify for the first bullet point of criteria of constant expression mentioned in JLS(Literals of primitive type and literals of type String )