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
About Question enthuware.ocpjp.v11.2.3625 :
Moderators: Site Manager, fjwalraven
-
- Posts: 11
- Joined: Thu Sep 01, 2022 10:58 am
- Contact:
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3625 :
The explanation is correct regarding overloading/overriding but the code is should be corrected to (float) (2*f1);
Updated.
thank you for your feedback!
Updated.
thank you for your feedback!
Who is online
Users browsing this forum: No registered users and 9 guests