Scala 2 dimensional Array and Arrays -
this question has answer here:
i trying write java ode in scala , think need help. problem:
java:
public static int[][] scorematrix = new int[5][20];
scala:
var scorematrix: array[array[int]] = new array[array[int]](5, 20)
it's not working, don't know why?
error "too many arguments constructor array(_length:int)array[array[int]]"
for initializing 5*20 2d int array can use:
var scorematrix: array[array[int]] = array.ofdim[int](5, 20)
your code doesn't work because array constructor has 1 argument, array length.
Comments
Post a Comment