Skip to content
Sharp

Concurrency basics · interview question

What will happen if two threads try to execute a synchronized method on the same object?

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

Correct answer

C. One thread will execute the method, and the other will wait.

Why

When a method is synchronized, only one thread can execute it at a time for a particular object. The other thread must wait until the first thread releases the object's monitor lock.

Test yourself on Concurrency basics

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

Start free test
All Concurrency basics questions →