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 does %d do in java?

584


What is composition in java?

730


What does string [] args mean?

543


what is meant by HQL?

646


How many inner classes can a class have?

584






What is lifetime variable?

527


What are thread safe functions?

517


Explain about instanceof operator in java?

615


Is array passed by reference in java?

584


Explain parallel processing in java8?

637


How can we make string upper case or lower case?

602


Can we override private method?

560


What are the methods available in a class?

589


What is logical variable?

518


Which package is used for pattern matching with regular expressions?

648