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!
About Question enthuware.ocpjp.v8.2.1276 :
Moderator: admin
-
- Posts: 6
- Joined: Wed Dec 14, 2016 11:29 pm
- Contact:
-
- Site Admin
- Posts: 10398
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1276 :
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.
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.
-
- Posts: 33
- Joined: Sat Feb 15, 2020 12:44 am
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1276 :
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?
-
- Site Admin
- Posts: 10398
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1276 :
> 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.
Yes.
Deadlock is not guaranteed because the JVM may execute the two threads sequentially.
Who is online
Users browsing this forum: No registered users and 5 guests