About Question enthuware.ocpjp.v17.2.3746 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
rlobato
Posts: 10
Joined: Fri Jun 28, 2024 3:08 am
Contact:

About Question enthuware.ocpjp.v17.2.3746 :

Post 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)
?

admin
Site Admin
Posts: 10386
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests