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 an object in java?
What is the difference between C++ and Java and your preferences?
How to declare an arraylist in java?
Is there any difference between synchronized methods and synchronized statements?
What are data types in programming?
What is the primitive type byte?
Can you call a method in a method?
How to disable caching on back button of the browser?
What is constructor in java ?
Which browsers work with java?
Explain the selection sort algorithm?
How do you change an int to a string?
can java object be locked down for exclusive use by a given thread? : Java thread
What is thread count in java?
What is the difference between super class & sub class?