(七)定长数组 val array_name = new Array[T](length) val array_name = Array("","") 通过()访问,而不是[] scala> val a = new Array[Int](5) a: Array[Int] = Array(0, 0, 0, 0, 0) scala> val a = Array("Jack","Luncy") a: Array[Stri…
scala> val x = 1 x: Int = 1 一.值与变量 值(val):赋值后不可变 val值名称:类型 = XXX 变量(var):赋值后可以改变 var变量名称:类型 = XXX scala> val x : Int = 1 x: Int = 1 scala> x = 2 <console>:12: error: reassignment to val x = 2 ^ scala> var x : Int = 1 x: Int = 1 scala>…