Page 1 of 1
About Question enthuware.ocpjp.ii.v11.2.3401 :
Posted: Sun Feb 23, 2020 6:54 am
by FlatPanda
The accepted answer is partial (as discussed in the explanation text, the constructor should create a defensive copy of the Date object too).
Are such partially correct answers to be expected in the real exam?
Re: About Question enthuware.ocpjp.ii.v11.2.3401 :
Posted: Sun Feb 23, 2020 7:34 am
by admin
Yes, you may get such options.
Re: About Question enthuware.ocpjp.ii.v11.2.3401 :
Posted: Sun Feb 23, 2020 1:15 pm
by FlatPanda
But you don't get options, where one is partially correct and one is fully correct, right?
What I mean, there won't be a constellation, where for example next to answer "you should clone the Date in the getter" there is a "you should clone the Date in the constructor and the getter" too? Or in this case you should just pick the fully correct answer and ignore the partially correct one? (In multiple-choice questions there were compositions, which go into this direction, but in select-one question I haven't encountered such yet.)
Re: About Question enthuware.ocpjp.ii.v11.2.3401 :
Posted: Sun Feb 23, 2020 10:52 pm
by admin
But there is no other option. Had there been an option saying Date should be cloned in the constructor, then you would pick that as well. In this case, Option 5 is the best option. It is true that the getDob method should return a clone of dob. There is no doubt about that, and so, you should select this option.