is overwriting an array in java the same as deleting the elements and inserting new ones? I have a 50x50 array that stores floating point values. A method calculates new values and sends them to the same array that already has these values for overwriting the previous ones. This is a recurring procedure. After around 1500 iterations, stackoverflow error occurs. Would it be different if I set the array to null first before writing values to it?
The code is:
float n = input.nextFloat();
public static void calculate_initial_float_values(){
for(int i = 0; i < a.length; i++){
for(int j = 0; j < a.length; j++){
a[i][j] = i+j+n*n ;
}
}
change_values();
}
public static void change_values(){
n = rng.Random(9);
calculate_initial_float_values();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.