What is constructor
Constructor is a special type of method whose name is same as class name. And it is used to contract the object.
Constructor does not contain any return type. If it contain return type then it must be treated as a method.
The main purpose of constructor is to initialize the object. And the constructor is automatically called at the time of object creation.
In java every class must contain at least one constructor.
Type of constructor : We have mainly two type of constructor i.e. Compiler generated constructor and programmer generated constructor.
Compiler generated constructor is default constructor . if the programmer does not add any contractor then compiler will automatically add one constructor which is know as Default constructor.
Programmer generated constructor are like parameterized constructor and no parameterized constructor.
A constructor through which we can pass any argument is called is paraedrites constructor .
A constructor which does’t contain any argument is called as aggrimemt.