Option B: When a synchronized method ends with a checked exception, the intrinsic lock held by the thread is released automatically.
Option C: A thread will retain the intrinsic lock if the return from a synchronized method is caused due to an uncaught unchecked exception. (Explanation of this: The intrinsic lock is released when the method ends. Irrespective of how it ends.)
I understood option B but I didn't fully understand option C. Is the only difference between them their exception type? If I understood correctly, synchronized method throws checked exception, the intrinsic lock is released but synchronized method throws unchecked exception, the intrinsic lock is NOT released.
About Question enthuware.ocpjp.v11.2.1754 :
Moderator: admin
-
- Posts: 16
- Joined: Sat Dec 16, 2023 7:22 am
- Contact:
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.1754 :
Option 3 is wrong because it says "A thread will *retain* the intrinsic lock if ..." but as the explanation says, "The intrinsic lock is released when the method ends. Irrespective of how it ends."
There is no contradiction between option 2 and 3.
There is no contradiction between option 2 and 3.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 20 guests