I have the following 2D Array:
int[][] matrixA = { {1, 2 ,3}, {4, 5, 6} };
And I want to create another 2D Array with the same size of matrixA
, my question is how do I do it with, the same way of an ordinary array, i.e, int[] arrayA = {10, 12, 33, 23}, int[] arrayB = new int[arrayA.length]
int[][] matrixB = new int[matrixA.length][]
Can I do it like this, only alocating one array with two positions and and leaving the rest to be filled with a for loop? Or there's a more correct and flexible way to do this?