constructor characterstics – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2018-03D #JAVA#4057    siteicon   siteicon  

Problem Statement - constructor characterstics

Write two characteristics of a constructor.

Solution

TC++ #4057

Constructor Characteristics:
1) Constructor name is always same as the class name.
2) Constructor does not return any data value, not even the void  data.

 

Notes

  • Some other characteristics are as follows –
    • Constructors are called automatically, when the instance of class (object) is created.
    • Constructors can be called only once, while the methods can be called any number of times.
    • Constructors can have arguments (parameterized) or may not have arguments (non-parameterized).
    • Constructors can have access modifiers like private, public, protected etc.
    • Constructors can be overloaded like other methods.
    • Constructors cannot be abstract, final, native, static, or synchronized.
    • Constructor do not return a data value, but they can return class instance.


Share

sunmitra| Created: 25-Mar-2018 | Updated: 12-Apr-2019|ICSE2018









Back