what is default constructor and parameterised constructor
with example?
Answer / 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 |
Can we have multiple public classes in a java source file?
How does class forname work in java?
What is a condition in programming?
What is difference between equals and hashcode method?
How to sort array in descending order in java?
Need to use public,static keywords in main function?
Can I extend singleton class in java?
what is aberivation of java?
how does multithreading take place on a computer with a single cpu? : Java thread
Why volatile is used in java?
Give an example of call be reference significance.
Why is String immutable?