Instantiation

From Suhrid.net Wiki
Jump to navigationJump to search

Constructors

  • Every class - including Abstract classes - MUST have a constructor.
  • Constructor chaining is built in. Every class constructor will call its default superclass constructor using super().
  • Every constructor as its first statement has a call to this() or super().
  • Compiler will only automatically insert call to no-arg super() or this().
  • CANNOT call an instance method or access instance variables till the super constructor has run.
  • Only Static variables can be accessed as a call to super() or this().