Answer Posted / bindhu
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 ? | 35 Yes | 4 No |
Post New Answer View All Answers
Is java call by reference?
What is the base class in java from which all classes are derived?
What is the purpose of abstract class?
What is the need of transient variables in Java ?
What is final method?
take an array with -ve and +ve value both.find out the nearest value of 0(zero).if two values are same like(-2 and +2)then extract +2 is nearest of 0(zero).
List two java ide’s?
Define how destructors are defined in java?
What is the use of isempty in java?
Where are register variables stored?
Explain scope or life time of local variables in java?
How are this() and super() used with constructors in java programming?
What is data structure in java?
How to solve the problem of generating the unique hash keys with hash function?
Explain the importance of import keyword in java?