Advertisements
Advertisements
प्रश्न
A constructor may have different names than the class name.
विकल्प
True
False
MCQ
सत्य या असत्य
उत्तर
This statement is False.
Explanation:
In Java (and many other object-oriented programming languages), a constructor's name must match the class to which it belongs. This is a significant factor because the constructor is called automatically when an object of the class is created, and having the same name guarantees that the constructor is appropriately identified.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?