English

When a program does not contain any constructor, Java compiler provides:

Advertisements
Advertisements

Question

When a program does not contain any constructor, Java compiler provides:

Options

  • a Null constructor

  • an overloaded constructor

  • a default constructor

  • a parameterized constructor

MCQ
Advertisements

Solution

a default constructor

Explanation:

  • The Java compiler assumes you still need to create objects. It secretly inserts an empty constructor with no parameters during compilation.
  • This default constructor initializes all instance variables to their default values (such as 0 for numbers, false for booleans, and null for objects).
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. (v) | Page 114
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×