+ 2
Can a Java Constructor be made final?
public class Blueprint{ final public Blueprint(){} }// is the use of the final keyword valid in this Java code?
7 ответов
+ 6
Constructors aren't inherited so can't be overridden so their is no use of having final constructor in Java !
When you don't want any method or function to be overridden than we make use the final constructor but constructor are by default from JLS (Java Language Specification) definition can’t be overridden, so there is no final constructor is present in java.
+ 6
No constructor cannot be made final or other modifiers accept public, private, protected, default.
+ 4
What do you get if you try to compile it.
+ 3
All aspiring Java Developers and present Java Developers are welcome to answer this question.
+ 3
There are even other non-access modifiers that cannot be used with constructors.
https://www.javaworld.com/javaworld/jw-10-2000/jw-1013-constructors.html
+ 3
You are all awesome! Knowledge truly unlocks the door to greatness. Thanks for your brilliant answers DishaAhuja & Avinesh
+ 3
A constructor gets invoked when a new object is created. And the answer is no. A constructor cannot be made final for the reasons DishaAhuja and Avinesh gave.