MathWorks interview question

How locks work in Java