35

使用Kotlin高效地开发Android App(三) - 简书

 5 years ago
source link: https://www.jianshu.com/p/1502012964c2?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
一. ?、!! 、lateinit 以及 let Kotlin 的类型系统旨在从我们的代码中消除 NullPointerException。 1.1 ? Kotlin基于Java的空指针提出了一个空安全的概念,即每个属性默认不可为null。 例如: 如果要允许为空,我们需要手动声明一个变量为可空字符串类型,写为String? 1.2 !! !!是非空断言运算符。将任何值转换为非空类型,若该...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK