In this lesson we discuss about Java constructor.
what is Java constructor-
In Java Constructor is a spacial type method that is used to initialize the object.
Why We Create Java Constructor-
When a object is instantiated(when you use new keyword) then the constructor initialize the newly created object.
Java basically two rules defined for the constructor.
1. Constructor name must be the same name as its class name.
2. Constructor must have no return type.