English

The name of a constructor is:

Advertisements
Advertisements

Question

The name of a constructor is:

Options

  • same as the class name

  • different from the class name

  • supposed to be a keyword

  • must be written in uppercase

MCQ
Advertisements

Solution

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
  Is there an error in this question or solution?
Chapter 4: Constructors - Exercises [Page 114]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 4 Constructors
Exercises | Q 1. (iii) | Page 114
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×