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
What is the method in java?
Can you explain inner class.
What is rule of accessibility in java?
What are passing parameters?
How do you find the maximum number from an array without comparing and sorting?
What are the differences between Java 1.0 and Java 2.0?
what is the difference between the methods sleep() and wait()? : Java thread
What is yield () in java?
What is the instance of an object?
Can we clone singleton object?
Can you instantiate the math class in Java?
What is literal example?
Can a constructor be protected?
What does flagged out mean?
Should a main method be compulsorily declared in all java classes?