What is constructor?
- Constructor is just like a method that is used to initialize the state of an object. It is invoked at the time of object creation.
What is the purpose of default constructor?
- The
default constructor provides the default values to the objects. The java
compiler creates a default constructor only if there is no constructor in
the class
Does constructor
return any value?
Ans:yes, that is
current instance (You cannot use return type yet it returns a value)
Is constructor
inherited?
No, constructor is not inherited.
Can you make a
constructor final?
No, constructor can't be final
No comments:
Post a Comment