0

I am new to Scala and have run into a problem defining multi-dimensional arrays.

I have tried the following type specifications that did not compile:

val shortfall: Array[Array[Int]]= new Array (6,248)  
val shortfall= new  Array.ofDim[Int] (6,248)

The following specification compiled but does not allocate an instance of the array. The type spec for parameter passing was Array[Array[Int]].

val shortfall=  Array.ofDim[Int] (6,248)

I am converting a modeling application from Java with the following definition

int[][] shortfall = new int[6][248]
4

1 回答 1

2
scala> Array.ofDim[Int](6,248)
res0: Array[Array[Int]] = Array(Array(0, 0, 0, ...))
于 2013-11-03T05:36:07.687 回答