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 messsage u r going to get from an objectoriented programing?
Is java good for beginners?
Can extern variables be initialized?
Is java a compiler?
What is dot operator?
What is a java predicate?
What are the 6 mandatory procedures for iso 9001?
Is arraylist ordered in java?
What does arrays sort do in java?
How finally used under exception handling?
Which is faster set or list in java?
How to overcome the exception object reference not set to an instance of object?
What is a container in a gui?
What is the major advantage of external iteration over internal iteration?
What is the purpose of using java.lang.class class?