Important Java Mcq 1

A constructor

a. Must have the same name as the class it is declared within.

b. fIs used to create objects.

c. May be declared private

d. (a), (b) and (c) above.

Answer:

d. a, b and c above

Explanation:

All the given options are true above constructors. A constructor must have the same name as the class it is declared within. A constructor can be used to create objects. A constructor may be declared private.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?