Interviews3 answers
Can you make a constructor final in Java?
3 Answers
Yes, if you make constructor as final we cannot create an instance of that class from
anywhere
Gude VenkataRaoPosted Sep 3, 2018, 6:55 AM EDT
No we can't make constructor final
Neha KumariPosted Nov 5, 2017, 8:49 AM EST
When you set a method as final, it means : "You don't want any class override it", but constructor by JLS definition can't overridden,so it is clean.
When you set a method as 'abstract',it means:"Method don't have any body and you want another time implement it in child class", but constructor call implicitly when new keyword used so it can't haven't body.
When you set a method as 'static', it means: "Method belong to class, not belong to object" but constructor implicitly called when construct time of class, so what it is static?
Munesh SharmaPosted Apr 15, 2014, 12:50 AM EDT
