About Question enthuware.ocpjp.v11.2.3625 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
Val Martinez
Posts: 11
Joined: Thu Sep 01, 2022 10:58 am
Contact:

About Question enthuware.ocpjp.v11.2.3625 :

Post 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

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

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

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

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests