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 parameter example?
Can we split string with in java?
How do you find the absolute value?
What is stack class in java?
Is .net better than java?
What is broken and continue statement?
What is a java lambda expression?
What are the 3 types of loops in java?
Describe the term diamond problem.
What is temp in java?
Where is the find and replace?
Difference between Linked list and Queue?
What is an argument java?
Can we have two methods in a class with the same name?
How many bytes is 255 characters?