1 不定长参数 def sum(args: Int*) = { var result = 0 for ( arg <- args) result += arg result } 2 数组初始化 val nums = new Array[Int](10) nums: Array[Int] = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) val nums1 = Array(1, 2, 4) nums1: Array[Int] = Array(1, 2, 4) 3 变长数组…