✏️ Explanatory Question

When is a constructor called

👁 896 Views
📘 Detailed Answer
896
Total Views
10
Related Qs
0%
Progress
💡

Answer with Explanation

Every time an object is created using new() keyword, at least one constructor is called. It calls a default constructor.

Note: It is called constructor because it constructs the values at the time of object creation. It is not necessary to write a constructor for a class. It is because java compiler creates a default constructor if your class does not have any.