About Question enthuware.ocpjp.v11.2.1754 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
hsnclk
Posts: 16
Joined: Sat Dec 16, 2023 7:22 am
Contact:

About Question enthuware.ocpjp.v11.2.1754 :

Post by hsnclk »

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.

admin
Site Admin
Posts: 10066
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v11.2.1754 :

Post by admin »

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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 236 guests