What is meant by constructor?

Answer Posted / onkdurga

constructor is a special type of member function,which has
the class name as function name.constructors doesn't have
any return type even void.constucter can be called
automatically at the time of object creation.Generally it
is used for initializing values to the data members.

constructorsare2types:1.default/parameterless
constructor
2.parametarized constructor

*costructor can not be inherited
*constructor can not be declared as static
*constructor can not be accessed outside of the class when
it is specified as private.

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between string and stringbuffer?

483


Can you extend main method in java?

607


What is the common usage of serialization?

559


Why java is made?

553


Is java a virus?

520






Define linked list and its features with signature?

526


Is special character in java?

593


What does replaceall do in java?

470


What do you mean by constructor?

536


How many ways can we create singleton class?

488


What is an example of a conditional statement?

550


What is the latest java version?

546


What should I import for arraylist in java?

498


Explain the difference between runnable and callable interface in java?

569


What are the major advantages of internal iteration over external iteration?

557