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 the difference between yielding and sleeping?
Which sorting algorithm is best in java?
What is the map interface in java programming?
What if constructor is protected in java?
What is the intersection and union methods?
How to access arraylist elements in java?
What is a byte string?
What are some characteristics of interference class?
What are the main differences between the java platform and other platforms?
what do you mean by java annotations?
What is the difference between import java.util.date and java .util?
How do you sort a string in alphabetical order in java?
How do I get the | symbol on my keyboard?
What is the difference between private & public & friendly classes?
What is the argument in java?