133k views
2 votes
A constructor

(a) Must have the same name as the class it is declared within.
(b) Is used to create objects.
(c) May be declared private
(d) Both (A) and (B) above
(e) (a), (b) and (c) above.

1 Answer

3 votes

Final answer:

A constructor must have the same name as the class it is declared within and is used to create objects. It may also be declared private.

Step-by-step explanation:

The subject of this question is Computers and Technology. The grade level is High School.

The correct answer is (e) (a), (b) and (c) above.

A constructor must have the same name as the class it is declared within, which is option (a). A constructor is used to create objects, so option (b) is also correct. Lastly, a constructor may be declared private, so option (c) is also correct. Therefore, the correct answer is option (e) (a), (b) and (c) above.

User Ryan Amies
by
8.2k points