If I have a 2D array, arr[][]
, and let say I do this: arr[0]=10;
What does this do? I only assigned 10 in the first dimension, but I didnt mention the second dimension. What happens in this case?
Edit: Ok what about this:
public static int[][] mystery(int[][] srcA, int[][] srcB) {
2 int width= srcA.length, height = srcA[0].length;
3 int[][] output = new int[width][height];
4 for (int x = 0; x < width; x++) {
5 if(x%2 ==0) output[x] = srcA[x];
6 else output[x] = srcB[x];
7 }
8 return output;
9 }