+ 3

Why constructor cannot be declared as final in java.

18th Jul 2017, 3:54 PM
Wasim Akhter
Wasim Akhter - avatar
2 Réponses
+ 15
When you set a method as final, it means : “You don’t want any class override it”, but constructor by JLS (Java Language Specification) definition can’t be overridden, so it is clean. Constructors aren't inherited so can't be overridden then what's the use to have final constructor! ;P
18th Jul 2017, 4:03 PM
Dev
Dev - avatar
+ 3
A constructor cannot be overriden. So there'd be no point in doing that.
18th Jul 2017, 3:58 PM
Rrestoring faith
Rrestoring faith - avatar