Page 1 of 1

About Question enthuware.ocpjp.v17.2.3746 :

Posted: Fri Jun 28, 2024 4:16 am
by rlobato
"Note that if you do not have printSum(int, int) method and if you try to call printSum(1, 2) , printSum(float, float) would be invoked instead of printSum(double, double) because a float is more specific (or closer) to an int than double is."

Isn't

Code: Select all

printSum(int a, float b)
being called instead of

Code: Select all

 printSum(float a, float b)
with

Code: Select all

printSum(1, 2)
?

Re: About Question enthuware.ocpjp.v17.2.3746 :

Posted: Fri Jun 28, 2024 8:13 pm
by admin
Yes, between printSum(int a, float b) and printSum(float a, float b), printSum(int a, float b) is more specific.

Between printSum(float a, float b) and printSum(double a, double b), printSum(float a, float b) is more specific.