I have a method which is filling two of the three dimensions of an array.
public static String[][] Method(){
double[][][] chromosom = new double [50][8][4];
for(int j = 0; j < 8; j++){
// generate random value ...
chromosom[0][j][0] = value*2;
chromosom[0][j][1] = value*3;
chromosom[0][j][2] = value*5;
chromosom[0][j][3] = value*9;
}
}
Now I want to use this array in my main to generate 50 of these arrays and to save them all in one array.
static double[][][] chromosom = new double [50][8][4];
public static void main(String[] args){
for(int i = 0; i < 50; i++){
Method();
for(int j = 0; j < 8; j++){
chromosom[i][j][0];
chromosom[i][j][1];
chromosom[i][j][2];
chromosom[i][j][3];
}
}
}
My problem is that I am not able to reach the chromosom array with its values from my main method.
returna value. I would suggest doing some tutorials before jumping into your own project. thenewboston has a really good video tutorial series.main. Also, you appear to be trying to use array access as a whole statement... please provide a minimal reproducible example rather than pseudo-code.