Skip to content
Sharp

Concurrency basics · interview question

Why can using synchronized(this) in a static method become a real problem?

Multiple choiceMediumchapter-15-curatedpremiumconcurrencysynchronized-and-locks
Choose one answer
Answer and explanation

Correct answer

B. It has no effect since static methods cannot use this.

Why

Static methods do not belong to any instance of a class, and therefore cannot use 'this'. Attempting to use 'synchronized(this)' in a static method results in a compile-time error.

Test yourself on Concurrency basics

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

Start free test
All Concurrency basics questions →