Skip to content
Sharp

Modern Java · interview question

Why might static factory methods be preferred for instance control when creating singleton objects?

Multiple choiceMediumchapter-7-curatedpremiummodern-javastatic-factory-methods
Choose one answer
Answer and explanation

Correct answer

A. They can always return the same instance.

Why

Static factory methods can manage instance control by always returning the same instance, which is a key feature when implementing singletons.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →