ArrayIndexOutOfBoundsException while I'm using array1[x].length I tried to debug the program & stops while copying the last row of array1.
public static double[][] addRow(double[][] array1, double[] array2){
double[][] copy=new double[array1.length+1][];
for(int x=0;x<array1.length;x++){
for(int y=0;y<array1[x].length;y++){
double[] temp=new double [array1[x].length];
temp[x]=array1[x][y];
System.out.print(temp[x]+" ");
}System.out.println();
}
return copy;
}```