what is default constructor and parameterised constructor
with example?
Answer Posted / tushar
Default constructor: this constructor is created by the compiler automatically whenever an object is created.User don't have to write default constructor every class has its default constructor
Parameterized constructor: this constructor is exclusively written by the coder to assign the initial value to an instance variable.By creating parameterized constructor you can overwrite the default constructor.
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
what is collatration?
How can we find the actual size of an object on the heap?
What is heterogeneous in java?
How do you use wildcards?
Is 0 true or is 1 true?
What’s the difference between the methods sleep() and wait()?
Why is whitespace important?
What is the advantage of functional interface in java 8?
Is it correct to say that due to garbage collection feature in java, a java program never goes out of memory?
What is the meaning of course?
Is there any way to skip finally block of exception even if some exception occurs in the exception block?
What is a vector in java?
What is the need of transient variables in Java ?
What is nullpointerexception?
What is difference between c++ and java ?