定义大小为3的数组
// var arr = arrayOf(3, 4, 5)
var arr = intArrayOf(3)
arr[0] = 1
arr[1] = 2
arr[2] = 3
也可以如下方式定义数组
var arr = arrayOfNulls<Int>(3)
arr[0] = 1
arr[1] = 2
arr[2] = 3
var size = arr.size
Log.i("tag","$size")
打印结果
com.maweiqi.kotlinday01 I/tag: 3
com.maweiqi.kotlinday01 I/tag: 3