inner class and local variable | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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 ответ
+ 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
Mr Rogue Knight
Mr Rogue Knight - avatar