Skip to content
Sharp

Modern Java · interview question

What does a static factory method in Java mainly do?

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

Correct answer

B. To create instances of a class.

Why

The primary function of a static factory method is to create and return instances of a class, often providing more flexibility and control than constructors.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →