Skip to content
Sharp

Modern Java · interview question

What does a static factory method return?

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

Correct answer

C. An instance of the class or its subclass.

Why

Static factory methods can return an instance of the class, its subclass, or even an instance from an object pool, providing flexibility in instance management.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →