Constructor
A constructor is a function that initializes a newly allocated object.
Related concepts: ClassObjectMethod
Closest Wikipedia entry: Constructor (object-oriented programming)
Misconceptions about Constructor17 documented Misconceptions
Check YourselfAllClassesHaveDefaultConstructor
All classes automatically get a no-argument constructorCannotChainMemberToConstructor
Method calls or field accesses cannot be chained to a constructor invocationConstructorAllocates
The constructor allocates the objectConstructorParameterIsField
Formal constructor parameters are equivalent to instance variablesConstructorReturnsObject
Constructors need to return objectsConstructorWithoutNew
One can write the constructor name, without new, to instantiate a classImmutableRequiresFinalParameters
Immutable classes need final constructor/method parametersMustInitializeFieldInConstructor
Constructors must assign values to all fieldsNoEmptyConstructor
A constructor must do somethingNoInsideMethodCallInConstructor
It is foirbidden to call other methods on the same object while inside its constructorObjectsMustBeNamed
A variable is needed to instantiate an objectThisInConstructorIsNull
In a constructor, this is null