Now that we know how object locking works, the next topic to understand is the lock scope. Just like variable scope, locks too have a scope. However, this can be understood only in terms of explicit locking using the concepts we learnt in the previous chapter on “Explicit Locking”
Since the lock() and unlock() method calls are explicit, we can move them anywhere, establishing any lock scope,