0
Can constructor in java be overloaded??
PLEASE CLEAR THIS..
2 Answers
+ 11
Yes constructors can be overloaded. You can write as many constructors as you want. The name should be same as class name but parameter list should be different.
See this code :
For example, you may also write another constructor for only name and another one for only age. It depends on how you want to create your objects.
https://code.sololearn.com/cpHx2iuWqzWt/?ref=app
0
According to what I've studied the answer is yes constructors can be overloaded but we've to follow some rules for that.