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
Explain momentum?
If you had a cylinder, sealed at both ends, with the pressure rising inside, would it blow at the end or split along the side first?
i want to know ,If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits.
Box 1 cotain odd value X or Y the box 2 =X i.e 7 or 12 box 3= Y has value 19 if X is 7 or 31 if x is 12 get even value X or Y Use any operator steps allowed 3.
when air is supplied from larger diameter pipe with some pressure if change diameter to small pipe the pressure increases or not? also what is increased pressureor velocity?
Why it is a preferable option in parallelextender development ?
how to delete four out of five duplicate records in a table using sql
What is the use of generics? when was it added to jdk?
Hello friend I am Manish from delhi I clear the written exam of NIC(national insurance company),If any one have any idea about inerview plz send me details my no:-9999026117,Email id:-bittu523@yahoo.com
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
hello sir,pls fdorward previous group-I exam papers .....
what is the need of constractor explain with sutable progarmming example
Write a test case plan for a typical banking application which involves functionalities like Balance enquiry, deposit, fund transfer etc. Make your assumptions and mention the same in your answer sheet.
to acheve the IP 65 protection class does it is mandatory to apply silicon grease?
Why DG Set manufacturers do not give options for alternative fuels. They even do not allow to change at the cost of custmers.