but here i=90; how does this mean that the value is being set at runtime and not at compile time? isnt i final here?
Joined: Oct 30, 2009
i is final, when its assigned a value it will not be changed.
I dont know if I am right, but what I think is that if assignment is done with declaration compiler does the assignment and replaces the final variable with its value.
but if final variable is declared and assignment part is done somewhere else compiler just checks the compatibility between the variable type and the value assigned, and actual assignment is done at runtime.
here when compiler encounters line 1 and if it assigns value then what will happen when it calls the constructor at line 2.
so if final variable is not assigned a value at declaration time, the assignment will be done at runtime according to the code.