About Question enthuware.ocajp.i.v7.2.1113 :
Moderator: admin
-
- Posts: 33
- Joined: Mon May 06, 2013 9:41 am
- Contact:
About Question enthuware.ocajp.i.v7.2.1113 :
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?)
-
- Site Admin
- Posts: 10159
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1113 :
The problem statement does say, "(Select the best option.)".
If you like our products and services, please help us by posting your review here.
-
- Posts: 13
- Joined: Mon Jun 16, 2014 1:07 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1113 :
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.
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.
-
- Site Admin
- Posts: 10159
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1113 :
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.
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.
-
- Posts: 46
- Joined: Sun Apr 21, 2024 10:43 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1113 :
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
because imagine Oracle says you are wrong it cannot be anytype such as primitive
i code with Paul Allen's mix
-
- Posts: 1
- Joined: Thu Aug 29, 2024 3:58 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1113 :
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.bptoth wrote: ↑Wed May 21, 2014 8:31 amPerhaps 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?)
Who is online
Users browsing this forum: No registered users and 4 guests