The <javaConstructorDef> element provides the constructor declaration
and is structured like a method declaration that has no result type.
Description
A constructor creates an
object that is an instance of a class:
ConstructorDeclaration::
ConstructorModifiersopt ConstructorDeclarator
Throwsopt ConstructorBody
ConstructorModifiers:
public protected private
|
The access modifiers values are
public,
protected,
and
private. Compilation errors occur if the same modifier appears
more than once in a constructor declaration, or if a constructor declaration
has more than one of the access modifier values.
ConstructorDeclarator:
SimpleTypeName ( FormalParameterListopt )
|
The SimpleTypeName in the ConstructorDeclarator must be the
simple name of the class that contains the constructor declaration. The
Throwsopt clause
for a constructor is identical in structure and behavior to the throws clause
for a method.
Unlike methods, a constructor cannot be abstract, static, final, native,
or synchronized.
Content model
(
(javaMethodAccess)
(optional) then
(javaParam)
(any number) then
(javaException)
(any number))