Can we overload a constructor in Java?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Works at the International Monetary Fund, Lives in Washington, D.C., USA.
In addition to overloading methods, we can also overload constructors in java. Overloaded constructor is called based upon the parameters specified when new is executed. Sometimes there is a need of initializing an object in different ways. This can be done using constructor overloading.
2023-05-13 12:30:28
评论(499)
Helpful(122)
Helpful
Helpful(2)

Lucas Lee
QuesHub.com delivers expert answers and knowledge to you.
In addition to overloading methods, we can also overload constructors in java. Overloaded constructor is called based upon the parameters specified when new is executed. Sometimes there is a need of initializing an object in different ways. This can be done using constructor overloading.