0

Can constructor in java be overloaded??

PLEASE CLEAR THIS..

18th May 2017, 2:52 PM
Ruchi sinha
Ruchi sinha - avatar
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
18th May 2017, 6:30 PM
Shamima Yasmin
Shamima Yasmin - avatar
0
According to what I've studied the answer is yes constructors can be overloaded but we've to follow some rules for that.
18th May 2017, 2:57 PM
Ruchi sinha
Ruchi sinha - avatar