Constructor

A constructor is a special method in a class that runs automatically when an object is created.

  • it will run every time the class is instantiated.
  • Even if you do NOT write a constructor, Apex will automatically generate a default constructor and it will run every time the class is instantiated.
  • No return type
  • Multiple constructors with different parameters are allowed.

Share