Page 1 of 1

About Question enthuware.ocpjp.v11.2.3075 :

Posted: Tue Jan 17, 2023 12:52 am
by yuir12
Hello, Question for Option 1:
public static double compute(double base, Function<Integer, Integer > func){     
return func.apply((int)base); }

What is the data type returned? Isn't it a double as per method name? Thanks.

Re: About Question enthuware.ocpjp.v11.2.3075 :

Posted: Tue Jan 17, 2023 1:27 am
by admin
Yes, it is always allowed to return an int whenever a double is expected. int will be widened to a double automatically.

Re: About Question enthuware.ocpjp.v11.2.3075 :

Posted: Tue Jan 17, 2023 5:02 am
by yuir12
oh got it thanks.