Can we make java program with two deafault constructor nd one parametrized constructor | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can we make java program with two deafault constructor nd one parametrized constructor

10th Feb 2018, 4:21 PM
Harsh Agrawal
Harsh Agrawal - avatar
2 Answers
+ 3
No. Just like you have to have different parameters for overloaded methods, you have to have different parameters for overloaded constructors. Having 2 with no parameters would cause an error because it wouldn’t know which one to call.
10th Feb 2018, 4:34 PM
Jacob Pembleton
Jacob Pembleton - avatar
0
okkk thnxxxx
10th Feb 2018, 4:43 PM
Harsh Agrawal
Harsh Agrawal - avatar