Skip to content
Sharp

Object-oriented programming · interview question

What role does a constructor play in the creation of objects in Java?

Multiple choiceMediumchapter-2-curatedpremiumoopobject-interaction
Choose one answer
Answer and explanation

Correct answer

B. It initializes new objects.

Why

Constructors are special methods used to initialize new objects. They set up initial states and allocate resources when an object is created.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →