Y
Yomi Smito
Why does this method alter the array "double[][] A", if the only one
whose elements are being set is "double[][] C" ? Help would be very
appreciated
static double[][] prueba (double[][] A,double[][] B){
double[][] C=new double[A.length][];
for (int i = 0; i < C.length; i++) {
C=A;
}
for (int i = 0; i < C.length; i++) {
for (int j = 0; j < C.length; j++) {
C[j]=0;
}
}
return C;
}
whose elements are being set is "double[][] C" ? Help would be very
appreciated
static double[][] prueba (double[][] A,double[][] B){
double[][] C=new double[A.length][];
for (int i = 0; i < C.length; i++) {
C=A;
}
for (int i = 0; i < C.length; i++) {
for (int j = 0; j < C.length; j++) {
C[j]=0;
}
}
return C;
}