3.7 Constructor

Id (Type Id ,...) {Statement ...}

Creates a constructor that is used in creating an instance of a class (called an object). The arguments given when creating an instance must be of the same type, and in the same order, as that specified by the constructor. The statements are executed in sequence in intializing the object. If the parent of the current class contains a constructor, that expects parameters, then the first statement in the constructor must be a super call.

Multiple constructors can appear in a class body, provided that for each constructor the type of arguments or the number of arguments us unique. Each constructor may set its own access. A constructor in the same class can be called using a this call. This must be the first statement.