Skip to content
Sharp

Engineering Interviews · interview question

In a code review, you spot a method that directly calls 'Thread.sleep()' inside a synchronized block. Why is this a potential issue?

Multiple choiceHardchapter-20-curatedpremiumengineering-interviewsjvm-trivia
Choose one answer
Answer and explanation

Correct answer

A. It will increase thread contention.

Why

Calling Thread.sleep() inside a synchronized block keeps the lock held during the sleep period, which can unnecessarily increase thread contention and reduce concurrency.

Test yourself on Engineering Interviews

A free test with instant, explained results. No account needed.

Start free test
All Engineering Interviews questions →