2 comments
·Dec 14, 2023
Dec 14, 2023
Hi there, thanks a lot this is very useful :) small note is lateinit does not work with primitive types, means this line lateinit var age: Int is not correct. on the other hand primitive types are used with lazy delegates
1
·
·1 reply
Author
·Dec 14, 2023
Thanks for the correction. Yes, you are right. lateinit cannot be used with primitive types. lateinit is designed for non-nullable types, and since primitive types like Int cannot be null, using lateinit with them is not allowed.
·