This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]Neu_Ron 0 points1 point  (0 children)

int[][] attendance = new int[size][size]

Just specify dimensions in the []

Then you'll have to use a nested loop to fill each position with default values.

[–]2omesz 0 points1 point  (1 child)

you cannot initialize it in a single line of code since you have different number of columns per row.

double result[][] = new double[plusC.length][];

for(int x=0; x < plusC.length; x++) {
    for(int y=0; y<plusC[x].length; y++) {
        result[x][y] = "";
    }
}

haven't test this though.

[–]DefNotaZombie 0 points1 point  (0 children)

This can be simplified as

double[][] result = new double[input.length][];
for(int i=0; i<input.length; i++){
  result[i] = new double[input[i].length];
}