Java Class Information:Constructors

The sequence Java uses when instantiating an instance of a class is:
  1. Java in 21 Days (122): "when your classes constructor is called, the constructor with the same signature for all your superclass is also called" ... if you want to explicitly call the supers constructor with specific signature: super(arg1, arg2, ..., argn)

    Nutshell (65): "If the first statement in a constructor is not an explicit call to a constructor of the superclass with the super keyword, then Java implicitly inserts the call super() - that is, calls the constructor with no arguments"

    Exploring(141) : default constructors are super() (no args) (of course these two have the same publisher :-) )

    The above thus indicates that constructors are invoked from Object down classes to particular class being instantiated (as is noted in the sequence).

  2. defaults
    • numbers default is 0
    • objects default is null
    • boolean default is false

  3. If also want wrap-around to another constructor of same class with different signature:
    this(arg1, arg2, ..., argn)
    Example: a default (nothing passed) which states common variables (i.e., defaults specified in method) and then sends these to a specific constructor which has these variables as arguments

    An exception to the default call to the super() for initialization is when the first line of a constructor, C1, uses the this() syntax to invoke another constructor, C2, of the class. Java relies on C2 to invoke the superclass constructor and does not insert a super() into C1. In other words, Java waits until it actually starts a constructor to either implicitly or explicitly start the call to super.