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

How many bits is a float?

0 Answers  


wat is class level lock and object level lock

3 Answers   HCL, Persistent,


how to print the below in java?thanks in advance.... * * * * * * * *

3 Answers  


what is the use of StringBuffer?

2 Answers   Accenture,


Nested classes VS Inner classes?

3 Answers   Infosys,






Explain the difference between an object-oriented programming language and object-based programming language?

0 Answers  


What is a dot notation?

0 Answers  


write a class to input 2 points by the user & check the line maked by the points is horizontal,vertical or rectangle?

1 Answers  


Why is java so popular?

0 Answers  


What is the default access specifier for variables and methods of a class?

0 Answers  


Explain the public class modifier?

0 Answers  


What is finalize() function in java?

0 Answers  


Categories