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 externalizable?
Write a function to print Fibonacci series and Tribonacci series?
Why is inheritance used in java?
What is a module function?
What is the difference between instanceof and isinstance?
how its run?
Is java developer a good career?
What is foreach loop in java?
How do you identify if jvm is 32-bit or 64-bit from java program?
What is a memory leak in java?
What are constants?
What is a protected method?
How do you initialize an arraylist in java?
How do I find and replace in word?
what are Hostile Applets?