| |
GeekInterview.com > Interview Questions > J2EE
| Print | |
Question: Final Variable
Answer: Why is that the final variable has to be intialized as soon as it is declare? |
| August 08, 2008 01:55:07 |
#1 |
| r.praveenkumar |
Member Since: October 2007 Total Comments: 27 |
RE: Final Variable |
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. |
| |
Back To Question | |