Lateinit and lazy initialization in kotlin. Difference between lateinit & lazy. #kotlin 6 program.

Lateinit and lazy initialization in kotlin. Difference between lateinit & lazy. #kotlin 6 program.

Android share

55 лет назад

415 Просмотров

Lateinit and lazy initialization in kotlin. Difference between lateinit & lazy. #kotlin 6 program.
1) lateinit property
lateinit property means late initialization initialize in future.
They are var properties that can be initialized later.
It cannot use with primitive data types like int or long etc
We have to sure before use that variable it will initialized otherwise
It will through an exception may app crash

2) lazy property
lazy property means layz initialization
They are val properties that can not initalize again and again.
It can use with premitive data types.
It can assign value when variable first time called otherwise not

My channel link subscribe to my channel
https://www.youtube.com/channel/UCCjZhrC5VJj-ost-9mPokDg

that's it from today hope you understand this video

please suggest if you want a video in any topic in comment below

Thanks
Ссылки и html тэги не поддерживаются


Комментарии: