Advertisements
Advertisements
प्रश्न
The name of a constructor is:
विकल्प
same as the class name
different from the class name
supposed to be a keyword
must be written in uppercase
MCQ
Advertisements
उत्तर
same as the class name
Explanation:
In programming languages like Java, a constructor is a special function used to initialise objects. To let the computer know it is a constructor and not a regular method, its name must match the class name exactly.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 4: Constructors - Exercises [पृष्ठ ११४]
