Kotlin 摘记
Publish by https://www.leachchen.com/
持续更新…
- 定义变量时,可在类型后面加一个问号?,表示该变量是Nullable,不加表示该变量不可为null。如下:
var s:String? = null
var s2:String = "xxx" //如果该变量被赋值为null,则编译不通过
Publish by https://www.leachchen.com/
持续更新…
var s:String? = null
var s2:String = "xxx" //如果该变量被赋值为null,则编译不通过