Why would you have multiple constructors in Java?

4 Answers. To put it simply, you use multiple constructors for convenience (1st example) or to allow completely different initialization methods or different source types (2nd example. … This is what constructor overloading means, that a Java class contains multiple constructors.

Sizin İçin Seçtik  What is inheritance explain how it is implemented?

Leave a Reply

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