In the Kotlin language we, by default, have to initialize each variable when it is introduced. To avoid this, the lateinit
keyword can be used. Referring to a lateinit
variable before it has been initialized results in a runtime exception.
然而,lateinit
不能与基元类型一起使用.为什么会这样?