Declaring lacal variable as final

I saw in may programs local variable is declared as final

for example

publicvoid testMyFunction{

final MyLocalVariable myLocal =new MyLocalVariable();

}

Is there any advantage of declaring local variable as final?

[437 byte] By [sunish_josea] at [2007-11-27 7:29:48]
# 1
> Is there any advantage of declaring local variable as final?You could use it in an inner class. See the relevant part of Java Language Specification.
hiwaa at 2007-7-12 19:09:58 > top of Java-index,Java Essentials,Java Programming...
# 2
It makes it clear to whomever reads the code that that variable is not intended to be modified. It also keeps you from accidentally modifying something that is intended not to be.
jverda at 2007-7-12 19:09:58 > top of Java-index,Java Essentials,Java Programming...