1.?:操作符 var str : String? = null Log.e("TAG", str?.toString()?:"空值") 运行结果:E/TAG: 空值 因此?:操作符是当我们的对象为空值时返回我们事先指定