Can we have more than one constructor in a class ? Explain your answer.
tia206:
mark me as brainest if satisfied with ans.
Answers
Answered by
2
Yes, we can have multiple constructors in a class BUT THEY MUST BE OF DIFFERENT PARAMETERS.It is in the form of CONSTRUCTOR OVERLOADING!
Answered by
0
Yes.A class can have multiple constructors, as long as their signature (the parameters they take) are not the same. You can define as many constructors as you need. When aJava class contains multiple constructors,we say that the constructor is overloaded (comes in multiple versions).
Similar questions