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


Please Help Members By Posting Answers For Below Questions

What is boolean data type in java?

557


What is the use of pattern in java?

500


What is starvation?

669


What are some characteristics of interference class?

506


What is a databasemetadata?

537






What are the common uses of "this" keyword in java ?

562


Write a java program to print fibonacci series?

531


Can you give few examples of final classes defined in java api?

550


what invokes a threads run() method? : Java thread

563


What does || mean in vectors?

465


What is the difference between overriding and overloading in OOPS.

545


Is it possible to specify multiple jndi names when deploying an ejb?

549


What is compareto () in java?

531


How to perform quicksort in java?

556


What is files manifesting?

1714