About Question enthuware.ocpjp.v11.2.3625 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Val Martinez
Posts: 4
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: 9804
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!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests