Hello everybody,
I have a doubt.
In
Java, Garbage Collection is not enforced on an object where a local variable in a method returns a value.
When defining an inner class within a method, the inner class cannot use the local variables of the method unless and until they are final.Basically the reason is why because the scope of the variable is limited to that method only.
Now my question is,if in a method there is a variable which returns a value to the calling method and it's refernce exists(because it is not eligible to be garbage collected) why can't the inner class use this variable in it?
thank you,
Venkat dasari