English

A constructor has the ______ (same/different) name as that of the class.

Advertisements
Advertisements

Question

A constructor has the ______ (same/different) name as that of the class.

Fill in the Blanks
Advertisements

Solution

A constructor has the same name as that of the class.

Explanation:

In languages like Java, a constructor must perfectly match the spelling and case of the class name. This allows the computer to instantly recognize it as an initialization block rather than a regular method.

shaalaa.com
  Is there an error in this question or solution?
Chapter 4: Constructors - Exercises [Page 115]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 4 Constructors
Exercises | Q 2. (i) | Page 115
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×