Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.
Why is that the final variable has to be initialized as soon as it is declare?
Profile Answers by vishalanand_154 Questions by vishalanand_154
Questions by vishalanand_154
Editorial / Best Answer
r.praveenkumarProfile Answers by r.praveenkumar Questions by r.praveenkumar
when a variable is declared as final we cant change its value again. we use final variable to declare a constant so when we declare a variable as final and if we were allowed to not to give its value at the time of declaration it would not make sense so people who designed java made mandatory to give the value when we declare a final variable. then only it will be sensible.
final PI=3.14;
then we cant change PI's value. think if the above statement do not contain a vl it would not make sense.