A constructor in Java is a special member that is called when an object is created. It initializes the new object’s state. It is used to set default or user-defined values for the object's attributes
A constructor does not have a return type, not even void.
A constructor is called automatically when an object is created using new.
Constructors can have parameters and can be overloaded.



Top comments (0)