Which of the following is a correct statement about constructors in Java?

2024

Which of the following is a correct statement about constructors in Java?

Answer: C. A constructor does not have a return type, not even void type.A Java constructor has the same name as its class and has no return type, not even void. Constructors can be overloaded, so the statement that a class can…

  1. A.

    Constructors cannot be overloaded.

  2. B.

    A constructor can be called directly like a regular method.

  3. C.

    A constructor does not have a return type, not even void type.

  4. D.

    A class can have only one constructor.

  5. E.

    Question not attempted

Attempted by 281 students.

Show answer & explanation

Correct answer: C

A Java constructor has the same name as its class and has no return type, not even void. Constructors can be overloaded, so the statement that a class can have only one constructor is false.

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…