What is constructor overloading?
Topic: Constructor overloading
Answer
Constructor overloading means defining more than one constructor in the same class, all carrying the class name but differing in their parameter lists — in the number, the types or the order of the parameters.
Example: a class Student may have Student() which sets default values and Student(String n, int m) which sets the values passed to it. Java decides which to run from the arguments given when the object is created.
Two things earn the marks: that the constructors share the class name, and that they are distinguished by their PARAMETER LISTS. Add that the return type cannot distinguish them — constructors have no return type at all. Worth one further line: constructor overloading is a form of compile-time (static) polymorphism, since the compiler decides which constructor to call.