Why can t we declare a constructor as final?in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why can t we declare a constructor as final?in java

14th Nov 2017, 5:46 PM
veeresh GB
veeresh GB - avatar
3 Answers
+ 6
In order to prevent a method to be overridden we use final key word to method. But in the case of constructor , constructor is never inherited so no need to make a constructor final https://www.quora.com/Why-can%E2%80%99t-constructors-be-final https://stackoverflow.com/questions/9477476/why-constructors-cannot-be-final
14th Nov 2017, 5:51 PM
MsJ
MsJ - avatar
+ 3
Constructors cannot be Overrided. So, there's no need for the final keyword.
14th Nov 2017, 8:26 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
because a constructor is called during object creation and adding the final keyword might just mean it's specifications must be constant?
14th Nov 2017, 5:52 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar