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 do you create a sop?

0 Answers  


What is the purpose of garbage collection in java? When is it used?

0 Answers  


What 4 doubled?

0 Answers  


How to sort a collection of custom Objects in Java?

0 Answers  


Give the hierarchy of inputstream and outputstream classes.

0 Answers  






What is the difference between Stream Reader and Stream Writer?

4 Answers  


What is Recursion Function?

0 Answers   iNautix,


In Inheritance if we are implementing Multi level inheritance and all class having same name of variable and now i want to access each class variable and how it is possible?

2 Answers  


How does arrays sort work in java?

0 Answers  


What are the advantages of inner classes?

0 Answers  


What is indexof?

0 Answers  


Is ResultSet class?

5 Answers   Bally Technologies, TCS,


Categories