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 a static class in java?

552


What is sortedset in java?

569


Explain java coding standards for methods?

600


What is an enumeration?

566


Give the hierarchy of inputstream and outputstream classes.

606






Is null a string in java?

552


Can set contain duplicates?

538


What’s the difference between unit, integration and functional testing?

612


Why is String immutable?

614


How do you sort a set in java?

514


What is the memory leak in java?

522


what is ststic with example

1592


What is return keyword in java?

557


What is flush () in java?

553


What is incompatible types in java?

533