Monday 25 July 2016

Constructor


  • Constructor is a special type of method whose name is the constructor.
  • Constructors are executed automatically when the object of the class is created.
  • Always Constructor’s visibility is public.
  • 2 types.
  1. Instance constructor.
  2. Static constructor.
  • The instance constructor called automatically when the object is created.
  • Instance constructor can be called as per the number of objects are created.
  • Instance constructor can be called method name "CONSTRUCTOR".
  • An instance constructor can have IMPORTING parameters and exceptions. You must pass all non-optional parameters when creating an object.





  • Static constructor can be called only once when the class has been loaded.
  • Static constructor has 1st priority than Instance Constructor.
  • Static constructor can be called method name " CLASS_CONSTRUCTOR".
  •  Static constructors have no parameters.
                          more information......


    No comments:

    Post a Comment