Can you make a constructor final in Java?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Studied at the University of Amsterdam, Lives in Amsterdam, Netherlands.
So making a constructor final is not required, so it is not used with constructor. 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. We can't make constructor to be final because constructor is never inherited.
2023-05-07 12:30:36
评论(499)
Helpful(122)
Helpful
Helpful(2)

Oliver Kim
QuesHub.com delivers expert answers and knowledge to you.
So making a constructor final is not required, so it is not used with constructor. 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. We can't make constructor to be final because constructor is never inherited.