Header Ads

  • Breaking Now

    How a Java object be locked for exclusive use by a given thread?

    A Java object can be locked for an exclusive use of a thread by making it available via a 'synchronized' block or method.Only a particular thread at given time which will be possessing the lock on the object will be able to do execution of code available in synchronized block or method, once this thread with lock is through with its executions then it releases the lock on the object and it is made available to the next thread in wait state.

    Post Top Ad

    Post Bottom Ad