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
how is final different from finally and finalize in java?
What is the default size of load factor in hashing based collection?
What java ide should I use?
How you can force the garbage collection?
What do you understand by the term singleton?
What are the differences between c++ and java?
What is time complexity java?
What’s the difference between unit, integration and functional testing?
What is use of arraylist in java?
What is the file type?
Why we use protected in java?
Why string is called as immutable?
Why null value is used in string?
Why are variables important in research?
What is the purpose of the system class in java programming?