Answer Posted / bindhu
Constructor is special type of member function that will
automatically invoke when an object creates. The purpose of
constructor is for the initialization of instance
variables. A constructor having the same name as that of
class name. It may have arguments but doesn't return
anything.
If we want to initialize all objects of the same class
with same values, use default constructor.Otherwise, we can
use parameterized constructor if we want to initialize
objects of the same class with different values. If we
don't specify any constructor , compiler will use default
constructor with garbage value.
Is This Answer Correct ? | 35 Yes | 4 No |
Post New Answer View All Answers
What is user defined exception in Java?
What is a priority queue java?
What is collection class in java? List down its methods and interfaces.
How big is a 32 bit integer?
What is a war file?
What is a java predicate?
What is class variable java?
What is a buffer in java?
How to call one constructor from the other constructor ?
Explain Basics of OOP Language in java
What is native method in java?
What is meant by vector class, dictionary class, hash table class, and property class?
What is entry in java?
What is java algorithm?
What is nested class?