What are the rules for creating constructor in Java?

Rules for Writing Constructors in Java The name of the constructor must be the same as the name of its class . A constructor must have no return type. It can not have not even void as its return type. We can use the access modifiers with a constructor to control its access so that other classes can call the constructor.

Sizin İçin Seçtik  Is there a default constructor in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *