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 value is a variable of the string type automatically initialized?
I want to re-reach and use an object once it has been garbage collected. How it's possible?
What is ellipsis in java?
What are some alternatives to inheritance?
How destructors are defined in java?
What are functions in java?
Can we modify the throws clause of the superclass method while overriding it in the subclass?
Can we override private method?
Why do we create public static method in java?
How does indexof work?
What are basic keywords?
What are access specifiers in java ?
What is type conversion in java?
Tell me about different OOPS concepts.
What is final method?