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
Explain about core java?
What is the difference between declaration and definition in java?
Can we catch more than one exception in a single catch block?
What is immutable data?
What is the reflection?
How do you test a method for an exception using junit?
Is string a wrapper class?
What are the Static and Dynamic Variables? Differentiate them.
how to open and edit XML file in Weblogic???
What is super keyword explain with example?
What is exception propagation?
What are the benefits of immutable objects?
Can we assign integer value to char in java?
How can I right-justify a string?
Which is faster set or list in java?