ConstructorModifier:
(one of)
Annotation public protected private
The rules for annotation modifiers on a constructor declaration are specified in §9.7.4 and §9.7.5.
It is a compile-time error if the same keyword appears more than once as a modifier in a constructor declaration, or if a constructor declaration has more than one of the access modifiers public, protected, and private (§6.6).
In a normal class declaration, a constructor declaration with no access modifiers has package access.
If two or more (distinct) method modifiers appear in a method declaration, it is customary, though not required, that they appear in the order consistent with that shown above in the production for MethodModifier.
Unlike methods, a constructor cannot be abstract, static, final, native, strictfp, or synchronized:
- A constructor is not inherited, so there is no need to declare it
final. - An
abstractconstructor could never be implemented. - A constructor is always invoked with respect to an object, so it makes no sense for a constructor to be
static. - There is no practical need for a constructor to be
synchronized, because it would lock the object under construction, which is normally not made available to other threads until all constructors for the object have completed their work. - The lack of
nativeconstructors is an arbitrary language design choice that makes it easy for an implementation of the Java Virtual Machine to verify that superclass constructors are always properly invoked during object creation. - The inability to declare a constructor as
strictfp(in contrast to a method (§8.4.3)) is an intentional language design choice; it effectively ensures that a constructor is FP-strict if and only if its class is FP-strict (§15.4).