javascript
Brief description  about Online courses   join in Online courses
View punitha  krishnasamy 's Profile

Final keyword

Hi ...

Could anyone explain final keyword in Brief with an example?
what is the advantage of using final keyword and what would happen when we declare the variable as final..

Thank you
Asked by punitha krishnasamy | Jul 26, 2012 |  Reply now
Replies (2)
View punitha krishnasamy 's Profile
Thank you sujay
Jul 28, 2012
View sujay kumar 's Profile
Hi.. Final Keyword is just like a constant like c language.in java we use final and if you declare any variable as final then the value of that variable never change during program.

if you declare any method as a final then you can not override that method in subclass

if you declare any class as final then you can not inherited or subclassed

and the advantage of Final keyword is you can improve the performance and it work fast in multithread environment
Jul 27, 2012