A constructor is a special method called when an object is created with new. It initializes the object's fields. A constructor has the same name as the class and no return type.
Basic Constructor
A constructor is a special method called when an object is created with new. It initializes the object's fields. A constructor has the same name as the class and no return type.