+ 1

inner class and local variable

why inner classes in java can't access to non-final local variables?

3rd Aug 2021, 9:58 AM
Mehran
Mehran - avatar
1 Réponse
+ 5
Inner class in java cannot acess local variables of the method in which the local inner class because local variables of the method is the local variables of the method are kept on the stack and lost as soon as the method ends
5th Aug 2021, 7:55 AM
Prashant Ranjan
Prashant Ranjan - avatar