Page 1 of 1

About Question enthuware.ocpjp.v8.2.1276 :

Posted: Thu Dec 15, 2016 10:11 pm
by ibugaienko
Hi!

I believe one of the correct answers is not entirely accurate, namely "Nothing can be said for sure". Is this an example for "exam-special" question wording? If not, maybe it would be more appropriate to mention that
"1 2" or "2 1" will be printed at least once as a more accurate option?
or
'1' and '2' will be printed at least once each, but the order is unknown.

Thanks!

Re: About Question enthuware.ocpjp.v8.2.1276 :

Posted: Fri Dec 16, 2016 1:22 am
by admin
There could be a deadlock also.
If you include all the possibilities in a statement then that statement can be a certainty. i.e. Only one of 1 or 2 or 3 or 4 will happen for sure. It is only when you talk about specifics, like which the other options have mentioned, you cannot be sure what will happen. So in that context, I think the option is ok in saying that you are not sure what will happen.

HTH,
Paul.

Re: About Question enthuware.ocpjp.v8.2.1276 :

Posted: Mon Feb 17, 2020 7:56 am
by bvrulez
admin wrote:
Fri Dec 16, 2016 1:22 am
There could be a deadlock also.
There can be a deadlock. But "1" and "2" will be printed at least once, each, right?

Also, the interesting question would by why there is not a deadlock for sure. Maybe if there is just one thread working both methods, but otherwise this is not possible, right?

Re: About Question enthuware.ocpjp.v8.2.1276 :

Posted: Mon Feb 17, 2020 8:36 am
by admin
> But "1" and "2" will be printed at least once, each, right?
Yes.
Deadlock is not guaranteed because the JVM may execute the two threads sequentially.