Explain, why the constructor is required in implemented
class?
Answer Posted / vimalan
constructor is used for initializing the class
variables.if constructor is not there,variables might be
taken the garbage values.To avoid garbage
values ,constructor is used.
Example:
Java:
int i;
initial value i=0;
C:
int v;
v=8823
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
Can we override constructor?
Why are getters and setters used?
What does singleton mean in java?
What are namespaces in java?
Is void a data type in java?
What is the difference between a constructor and a method?
What is a boolean expression in java?
Why main method is static in java?
What is a Hash Table? What are the advantages of using a hash table?
What are thread safe functions?
What is a void method java?
What is parsing in grammar?
How many times finalize method will be invoked? Who invokes finalize() method in java?
What is getclass () getname () in java?
What are the methods available in a class?