hope you all are having a good day.
I've got a problem with my code, i am trying to save some values to an array, the array position gets moved by a counter, but when i try to save the values, it displays an error on the console.
this is the code.
if(i<6){
i++;
jTxtEstrategia.setText(String.valueOf(i));
A = (Math.random() * 8);
B = (Math.random() * 8);
C = (Math.random() * 8);
D = (Math.random() * 8);
jTxtA.setText(""+(int)A);
jTxtB.setText(""+(int)B);
jTxtC.setText(""+(int)C);
jTxtD.setText(""+(int)D);
int[] j = new int[i];
int[] k = new int[i];
int[] l = new int[i];
int[] m = new int[i];
j[i]=(int) A;
k[i]=(int)B;
l[i]=(int)C;
m[i]=(int)D;
System.out.println("Estrategia "+i+"\n Sucursal A: "+j[i]+"\n Sucursal B: "+k[i]+"Sucursal C: "+l[i]+"\n Sucursal C: "+m[i]);
}else{
jButtCalc.setEnabled(false);
}
The objetive is to save those values to save some code and compare them later on.
I appreciate your time,
Regards (sorry for my bad english).