Thanks Buddies.
Further to this, if you consider method-local inner class(inner class defined inside a method), it can't use the local variable of the method it is in.
According to K&B, its because local variables are not guanateed to be alive after the method completes. They go on to say if the variable was declared final, then it's have been accessible by the method-local inner class. Whats the reason, do you know why?
---------
Hello Jibs,
I think even if you declare the variable as final, it wont affect the scope of variable. I tried creating sample class and observed the stack. It is creating final variable only when it enters the block and removing when it leaves the block. Did you observe this case anywhere?
cheers,
Sudhakar.
----------
Sudhakar,
How did you check the elements in the stack?
Thanks