Aniket Kedari wrote:Thanks for information.
But final variables of a method are also stored on stack. So isn't there a risk that the final variable will be deleted from the stack before the lifetime of any objects of that class finishes.
Hi Guys,
Its an old post, Though i got to read this one and woukld like to answer this one clearly.
As method local inner class are given the final local variable copy to be stored into thier hidden private variables, corresponding parameters are added into the construtor call as well, as to get them initialized. So inner class now saperately stored final variable copy into its private members. If stach call of method dies and so the local variable also, it wont effect the private copy accessed through any still alive heap object of inner class.
Ranch's please correct if i am mistaken here..
Thanks.