हिंदी

A constructor may have different names than the class name.

Advertisements

प्रश्न

A constructor may have different names than the class name.

विकल्प

  • True

  • False

MCQ
सत्य या असत्य
Advertisements

उत्तर

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
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 7: Constructors - EXERCISES [पृष्ठ ४१८]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
अध्याय 7 Constructors
EXERCISES | Q III. 6. | पृष्ठ ४१८
Advertisements
Share
Notifications



      Forgot password?
Use app×