local variable in lambda expression

Опубликовано: 19 April 2020
на канале: Coding & Fun
1,033
27

The fundamental difference between a field and a local variable is that the local variable is copied when JVM creates a lambda instance. On the other hand, fields can be changed freely, because the changes to them are propagated to the outside class instance as well (their scope is the whole outside class, as Boris pointed out below).

The easiest way of thinking about anonymous classes, closures and labmdas is from the variable scope perspective; imagine a copy constructor added for all local variables you pass to a closure.

Please Like | Share | Subscribe my channel.

For subscribing my channel, click on below link:
   / @codingfun3807  

Follow us on :
Instagram: @ankigupta091
Facebook: @ankigupta091

Don't forget to click on bell icon for further updates.


На этой странице сайта вы можете посмотреть видео онлайн local variable in lambda expression длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Coding & Fun 19 April 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,033 раз и оно понравилось 27 зрителям. Приятного просмотра!