Page 1 of 1

About Question enthuware.ocpjp.v11.2.3625 :

Posted: Tue Jan 17, 2023 12:14 pm
by Val Martinez
The second option

public void setF(double f1){ this.f = (float) 2*f1; }

doesn't compile: "cannot convert from double to float"


So, the answer
"Since the parameter type is different, it is overloading not overriding"
should be corrected

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

Posted: Thu Jan 19, 2023 12:52 am
by admin
The explanation is correct regarding overloading/overriding but the code is should be corrected to (float) (2*f1);

Updated.
thank you for your feedback!