About Question enthuware.ocajp.i.v7.2.1113 :

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

Moderator: admin

Post Reply
bptoth
Posts: 33
Joined: Mon May 06, 2013 9:41 am
Contact:

About Question enthuware.ocajp.i.v7.2.1113 :

Post by bptoth »

Perhaps if the question was put in the form of "Select the best option", it could be detailed why the chosen answer regarding covariant types should be considered "better" than plain Object (for me it is quite much context dependent what to use, so I do not consider this a very good phrasing, but maybe there are similar questions in the real exam as well?)

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

Re: About Question enthuware.ocajp.i.v7.2.1113 :

Post by admin »

The problem statement does say, "(Select the best option.)".
If you like our products and services, please help us by posting your review here.

Brian B
Posts: 13
Joined: Mon Jun 16, 2014 1:07 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1113 :

Post by Brian B »

After reading the explanation, I agree with the answer. However, I think "Select the best option" is subjective. Wouldn't both String and Object be technically valid answers? Would what is considered the "best option" be based on the purpose of the code being written?

As far as reinforcing the concept this question is trying to teach, would it make more sense if it allowed selection of multiple answers? Perhaps including primitives in the choices would help to clarify the point that covariance doesn't apply to them.

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

Re: About Question enthuware.ocajp.i.v7.2.1113 :

Post by admin »

Yes, they are valid options. However, there will be situations in the exam where multiple valid options may be present but you have to pick only one. So you have to select the option that is most suitable.

You are right about primitives. The explanation has been enhanced to explain that as well.

Paul.
If you like our products and services, please help us by posting your review here.

raphaelzintec
Posts: 46
Joined: Sun Apr 21, 2024 10:43 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1113 :

Post by raphaelzintec »

i hope i wont have Oracle error by saying: Return type can be any class since all objects can be cast to Object.

because imagine Oracle says you are wrong it cannot be anytype such as primitive
i code with Paul Allen's mix

Newtoned
Posts: 1
Joined: Thu Aug 29, 2024 3:58 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1113 :

Post by Newtoned »

bptoth wrote:
Wed May 21, 2014 8:31 am
Perhaps if the question was put in the form of "Select the best option",best sex dolls it could be detailed why the chosen answer regarding covariant types should be considered "better" than plain Object (for me it is quite much context dependent what to use, so I do not consider this a very good phrasing, but maybe there are similar questions in the real exam as well?)
In the context of an exam or coding best practices, covariant types are often considered "better" than using Object because they offer a balance of flexibility and safety. However, the "best" option always depends on the specific use case and the context in which the code is being written.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests