If I have a function that takes a double
as an argument, I can easily put in a float
.
However when I have a funcion that takes a double[]
then I cannot pass a float[]
.
public static void doSomethingWithMyDoubles(double[] doubles) {
//....
}
public static void doSomethingWithMyDouble(double doubles) {
//....
}
public static void main() {
float floater = 10f;
double doubler = 10d;
doSomethingWithMyDouble(doubler) // OK
doSomethingWithMyDouble(floater) // OK
float[] floates = new float[10];
double[] doubles = new double[10];
doSomethingWithMyDoubles(doubles) // OK
doSomethingWithMyDoubles(floates) // NOK
}