Hi,
I have a question regarding method local inner classes. In page 671 of
SCJP book, K&B states that non final method local variables are not visible inside a method local inner class and that the inner class object might still be alive on heap somewhere even after jvm has winded the stack associated with the method. This is why a method local inner class can access only the final of the local variables.
So then what is the scope of the method local final variables? Do they live longer than other method local variables? And how can the reference of a method local inner class object be assigned to an instance field? I tried declaring InnerClass obj in OuterClass but it wouldn't recognize it.
So then how can I assign obj to another instance reference? What would be the scope of obj if it is not assigned to an instance reference? Would it be eligible for garbage collection once the control moves out of the method?
Thanks in advance.
Chan.