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 boolean false?
Explain about complier design(phases)
What about main() method in java ?
What is the function of http?
What is the benefit of lambda expressions?
What are the 4 versions of java?
What is qualitative variable?
What are the high-level thread states in java programming?
Explain differences between collection api and stream api?
What is the old name of java?
What is mutable object and immutable object?
Explain listiterator and methods in listiterator?
What is the use of isempty in java?
What is callable java?
how to know the total memory occupied by the objects in the ArrayList(Array list may contain duplicate objects)