Skip to content
Sharp

Object-oriented programming · interview question

Which of the following is true about the constructor name in Java?

Multiple choiceEasychapter-2-curatedpremiumoopconstructors
Choose one answer
Answer and explanation

Correct answer

C. It must match the class name exactly

Why

A constructor's name in Java must exactly match the class name, distinguishing it from other methods and signaling its role in object creation.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →