Is it more efficient to be doing this:
double[] a = new double[5];
for (int i = 0; i < a.length; i++) {
a[i] = i;
}
rather than this:
public class DataStore {
public double a, b, c, d, e;
public DataStore(double a, double b, double c, double d, double e) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.e = e;
}
}
...
new DataStore(0, 1, 2, 3, 4);
Is there any added efficiency that would greatly impact the performance of the java application using the "double[]" array? Or would the difference only be negligible?