Case 1
Originally posted by Nikhilesh Fonseca:
Also if u just wana kno abt final variables
The can be left unintialzed & these are known as blank final varaibles.
But if these belong to your class as opposed to method(Local) they must have a value before your class terminates else u will get a compilation error..
Case 2
But if these are local final variables they can be left unitilazed you will not get a compiler error ..But u must initialze them b4 u use them..
Needless to say once they have a value these values become final that is u cannot change them.
why the difference in the 2 cases. i mean it should be that if u dont use blank final variables why bother with assignment?? on same grounds that i dont care when i declare local variable and dont use it.
So why the compiler is unhappy when i cheat final instance variables when it allows me to cheat local final variables...