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 old name of java?
What is a default constraint?
When we serialize an object does the serialization mechanism saves its references too?
What are 5 boolean operators?
What is the difference between variable declaration and variable initialization?
What is difference between hashset and hashmap?
What is finally block?
How do you convert an int to a double in java?
What is polymorphism and what are the types of it?
Is java a compiler?
What does java se mean?
Explain about oops concepts.
What is a boolean in java?
What is complexity in java?
Explain about narrowing conversion in java?