As we all know constructor cannot be overridden. So when we declare a constructor as final
, why does it give compile time error? As final
keyword will also let a constructor not to override.

- 24,264
- 12
- 69
- 143

- 21
- 2
-
2what language do you mean? – KonstantinL Mar 14 '16 at 11:14
-
3Constructors are not ordinary methods. Constructors are never inherited, so there is no sense in declaring them final. – Kasper Due Mar 14 '16 at 11:18
-
7http://stackoverflow.com/questions/9477476/why-constructors-cannot-be-final – soorapadman Mar 14 '16 at 11:28
2 Answers
Only public
,private
,protected
are allowed as modifiers. final
is an not allowed as per the JLS
. final
in java is to restrict the extension.
In java constructors
can not be overridden. Super class's constructor is always called from any Constructor of the base class (implicitly or explicitly). final
is used to prevent any method from being overridden, constructors are not like normal methods and also can not be overridden
. making constructors
as final
will not make any sense. Making this will not be defined as any feature.
You can make the class as final if you wish to prevent its extension. If you wish to restrict the constructor of an class just make it private.

- 5,204
- 4
- 33
- 55
No Constructors
can NEVER be declared final
. Your compiler will always give an error of the type "modifer final
not allowed"
Final, when applied to methods, means that the method cannot be overridden in a subclass.
Constructors are NOT ordinary methods. (different rules apply)
Additionally, Constructors are NEVER inherited. So there is NO SENSE in declaring it final.

- 507
- 1
- 5
- 21