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
What does \ mean in regex?
What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?
What initialize variables?
What will be the initial value of an object reference which is defined as an instance variable?
Why java is platform independent? Explain.
What is difference between iterator access and index access?
Why can't we use static class instead of singleton?
Describe how to implement singleton design pattern in struts.
What is a java applet? What is an interface?
Write a program to reverse a number in java?
What do you understand by garbage collection in Java? Can it be forced to run?
Which is bigger double or float?
Why java is a platform independent? Explain
What is concurrent hashmap and its features?
Which methods cannot be overridden in java?