0
What is the constructor?

Open 1 Answers 21 Views Education
What is the constructor?

1 Answer

0

What is the constructor?

The constructor can be defined as the special type of method that is used to initialize the state of an object. It is invoked when the class is instantiated, and the memory is allocated for the object. Every time, an object is created using the new keyword, the default constructor of the class is called. The name of the constructor must be similar to the class name. The constructor must not have an explicit return type.

by (54.6k points)
...