Answer Posted / ravina gaikwad
Constructor is special type of member function that will
automatically invoke when an object creates. The purpose of
constructor is for the initialization of instance
variables. A constructor having the same name as that of
class name. It may have arguments but doesn't return
anything.
If we want to initialize all objects of the same class
with same values, use default constructor.Otherwise, we can
use parameterized constructor if we want to initialize
objects of the same class with different values. If we
don't specify any constructor , compiler will use default
constructor with garbage value.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between final, finally and finalize() in java?
How to reverse string in java?
When is the finalize() called? What is the purpose of finalization?
What is the difference between import java.util.date and java .util?
How can an object be unreferenced?
What does i ++ mean in Java?
Can a class be declared as static?
What is io stream in java?
What is off heap memory?
What is the purpose of the system class in java?
What do you understand by private, protected and public?
What is the impact of declaring a method as final?
What is the purpose of lambda expressions?
Differentiate between stringbuffer and string?
What is the exact difference in between unicast and multicast object? Where we will use?