Which of the following statements are true about
constructors and methods?

1)A constructor has it's own name, a return type and is
invoked using the new operator.
2)A function has it's own name, a return type and is invoked
using the dot operator.
3)A constructor has the name of the class, no return type
and is invoked using the new operator.

Answer Posted / prince

2 & 3 are correct answers for sure.

because,
constructor is invoked at the time of creation of the object to a class, hence it is invoked using new operator, and the name of constructor and class must be same coz, the default constructor is invoked at the time of creation of object, and lastly, constructor has no return type and it can only returns constructor ( the concept of copy constructor)




if I am wrong are any modifications needed, please plz plz plz plz inform me

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how is the config take place and from reciever side how will process the data into internal table

1505


I am having 17 months experience in development.I want to take testing as my career.I dont have experience in testing. Will get job anywhere?

1569


2. A product selected for testing is equally likely to have been produced by one the 6 machines/processes. (i) Determine sample space ‘S’ (ii) What is the probability that the product is from machine 1? (iii) What is the probability that the product is from machine 2 or machine 4? (iv) What is the probability that the product is from both machine 5 and machine 3? (v) What is the probability that the product is not from machine 6? (vi) What is the probability that the product is not from either machine 6 or machine 1?

1700


multithreading??

1688


what is the program to find out the smallest word in a sentence? like if the sentence is : this is my room. then out put will be : is

1497






c ka base kya hota hai? what is communication?

4934


W.A.P to take input of an array and display the entered no. in dos.

1789


How To Servers For Malitnationl Bank?

1588


WHY WE USE {} AT THE STARTING OF C PROGRAM

1674


explain overloaded constrator © constractor

1857


I am student pursuing B.E/B.tech in Computers 8'th sem.What should i do for a better carrier.Plz suggest other than programming languages.Is the ERP a better one to do?plz help...

1710


what is your experience in developing technical specifications?

1775


pls i need a help from you friends, is there anybody who can help me out with the question been ask from the USA embassy. i will be going for interview next month pls help me

1533


Can have i call constructor in interface?

1600


why do you want to join tcs

2131