Skip to content
Sharp

Spring Core · interview question

Which approach can help ensure thread safety when using singleton beans?

Multiple choiceMediumchapter-9-curatedpremiumspring-corebean-scope
Choose one answer
Answer and explanation

Correct answer

D. Use synchronized methods

Why

Using synchronized methods or blocks can help ensure that only one thread accesses critical sections of code at a time, thereby maintaining thread safety when using singleton beans.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →