English

A constructor may have different names than the class name.

Advertisements

Question

A constructor may have different names than the class name.

Options

  • True

  • False

MCQ
True or False
Advertisements

Solution

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

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 7 Constructors
EXERCISES | Q III. 6. | Page 418
Advertisements
Share
Notifications



      Forgot password?
Use app×