Skip to content
Sharp

Modern Java · interview question

Static factory methods can return:?

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

Correct answer

D. Instances from a cache.

Why

Static factory methods can return instances from a cache, allowing for instance reuse and potentially improving performance by avoiding unnecessary object creation.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →