Header Ads

  • Breaking Now

    What's the difference between constructors and other methods?

    Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.

    1 comment:

    1. Also a constructor does not have a return type where as methods have a return type.
      Constructors are invoked only when creating new objects(using the new keyword) where was methods are invoked any number of times within a class / by an instance of a class.


    Post Top Ad

    Post Bottom Ad