Skip to content
Sharp

Engineering Interviews · interview question

Which Java feature helps prevent race conditions in a multi-threaded application?

Multiple choiceMediumchapter-20-curatedpremiumengineering-interviewscode-review-spotting-bugs
Choose one answer
Answer and explanation

Correct answer

A. Synchronized methods

Why

Synchronized methods ensure that only one thread can access the resource at a time, preventing race conditions. This controls access to shared data and maintains data consistency.

Test yourself on Engineering Interviews

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

Start free test
All Engineering Interviews questions →