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 :
Moderator: admin
-
- Posts: 11
- Joined: Thu Sep 01, 2022 10:58 am
- Contact:
-
- Site Admin
- Posts: 10046
- 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!
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: Google [Bot] and 72 guests