Scala --- Chapter 3 Array-related operations

Enter image description

Next comes the boring basic theory. . .

1. Fixed-length array

Enter image description

//初始化为0
val nums = new Array[Int](10)
//null
val a = new Array[String](10)
//推断类型,有值不需要new
val s = Array("hello","world")
//使用()而不是[]访问数组
s(0) 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325393606&siteId=291194637