What is meant by constructor?

Answer Posted / suman blazta

Constructors are used to create and initialize objects of their class type.
Constructor is a special member function that takes the same name as the class name.The constructor is automatically named when an object is created. A constructor is named whenever an object is defined or dynamically allocated using the "new" operator.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens if main method is not static?

487


What is Major and importance difference between for and foreach loop ?

565


What technique can be employed to compare two strings?

565


How are the elements of a gridbaglayout organized in java programming?

510


can I implement my own start() method? : Java thread

540






What do you mean by append?

522


Can we sort set in java?

527


design an lru cache in java?

534


Add a value x to array from index l to r where 0 <= l <= r <= n-1

614


Give the difference between the println method and sqrt method?

616


What do you understand by looping in java? Explain the different types of loops.

551


What is string and its types?

602


Can we use switch statement with strings?

609


Is null an object in java?

551


What is methods in java?

504