what is default constructor and parameterised constructor
with example?



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

Post New Answer

More Core Java Interview Questions

What is the difference between quicksort & mergesort? When should they be used? What is their running time?

0 Answers   Akamai Technologies,


Is passing by reference faster?

0 Answers  


What is an inner class in java?

0 Answers  


Why declare Main() inside the class in java ?

0 Answers   HCL,


What are the disadvantages of object oriented programming?

0 Answers  






What is the difference between multiple processes and multiple threads?

0 Answers  


when,where and how to use abstract class and interface

2 Answers  


What is the purpose of the strictfp keyword?

0 Answers  


What is meant by class loader and how many types are there?

2 Answers   Apple,


what is bmg file and how to create that files?what will it contailn?

0 Answers   HCL, Probe Services,


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

0 Answers  


Explain illegalmonitorstateexception and when it will be thrown?

0 Answers  


Categories