Skip to content
Sharp

Object-oriented programming · interview question

In an e-commerce application, how would you safely share a 'Product' object across multiple threads?

Multiple choiceHardchapter-2-curatedpremiumoopobject-references
Choose one answer
Answer and explanation

Correct answer

A. Use synchronization to control access.

Why

To safely share a 'Product' object across multiple threads, synchronization can be used to control access to the object's state. This prevents concurrent modifications and ensures consistency.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →