I have this snippet :
static class Foo {
Double[] array;
Double value;
public Foo(Double[] array) {
this.array = array;
}
Foo(double value){
this.value = value;
}
}
public static void main(String[] args) {
double[] array = new double[]{1,2,3,4,5,6,7};
double value = 10;
new Foo(value); //this is normal
new Foo(array); //syntax error cannot resolve constructor Foo(double[])
}
I get syntax error
cannot resolve constructor 'Foo(double[])'
Why I can pass variable of type double
to method that receive Double
, but I cannot pass an array of type double[]
to method that receive Double[]
as parameter