need help with array
Hello everyone, my problem is getting values from array when i use return statement, thing is, everything works fine, i use JFormattedTextFields and blah blah other things, for example if i use:
when declared
double a1,a2,a3 ....=0;
double [] arr;
in init phase
double [] arr=new double[]{a1,a2,a3};
and when i have to get entered values i use PropertyChangeListener with return statement:
double something(double[] arr) {
double answer=0;
answer=a1+a2+a3;
return answer;
}
but next thing, which isnt working i dont know why:
double[] arr;
double x[];
public NewJFrame() {
x=new double[3];
for(int i=0;i<x.length;i++){
x=0;
double[] arr=new double[]{x};
}
initComponents();
}
blah blah (lot of code)
double something(double[] arr) {
double answer=0;
answer=x[0]+x[1]+x[2];
return answer;
}
It shows that build is successful, but nothing shows up, if i disable answer=x[0]+x[1]+x[2]; it builds
so i guess something is wrong with values or theres something else i should know!>

