I have to input three array elements and then a method should calculate them and return the answer. I only have this :
boolean answer = false;
final int ARRAY_SIZE = 3;
int sum[] = new int [ARRAY_SIZE];
for(int i = 0; i<sum.length;i++){
sum[i]= Integer.parseInt(JOptionPane.showInputDialog("Please enter a number"));
}
answer = one(sum);
JOptionPane.showMessageDialog(null,"The sum of the elements is "+answer);
}
public static boolean one(int[] nums){return(nums[0] + nums[1] + nums[2]);}
}