why the constructor should be used in class,if there is no
constructor what will happen?
Answer Posted / bindhu
In Java, initialization of every object possible
by providing a constructor. If a class has a constructor,
Java automatically calls that constructor when an object is
created. So initialization is guaranteed.
If we don't define a constructor for a class, a default
parameterless constructor is automatically created by the
compiler.
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is a finally block?
What is Hierarchy of exception?
What is the difference between pass by reference and pass by pointer?
What is java util list?
Compare overloading and overriding?
How many bits is a double?
What are loops in java?
What is difference between == equals () and compareto () method?
What is the difference between && and & in java?
What is the program development process?
What sorting algorithm does javascript use?
Difference between arraylist and vector.
Why javac is not recognized?
What does java final mean?
Is age a discrete variable?