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
Is constructor inherited?
Is java 9 released?
Can we create constructor in abstract class ?
Difference between linkedlist and arraylist.
What is off heap memory?
What is lexicographically smallest string?
What is constant in programming?
What are the main uses of this keyword?
what r advatages of websphere? & how to deploy?
What is generic type?
Difference difference paint() and paintcomponent()?
What is exception propagation?
What is the purpose of the runtime class in java programming?
What are the two ways in which thread can be created?
What do you mean by stream pipelining in java 8?