Advertisements
Advertisements
Question
For which purpose a constructor is used?
Options
To initialise the instance variables
To provide the instance variables
To organise the instance variables
To simplify the instance variables
MCQ
Solution
To initialise the instance variables
Explanation:
A constructor sets default or user-defined settings for data members when an object is created.
shaalaa.com
Is there an error in this question or solution?