sameer inamdar


{ City } pune
< Country > india
* Profession * student
User No # 75227
Total Questions Posted # 0
Total Answers Posted # 2

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 10
Users Marked my Answers as Wrong # 1
Questions / { sameer inamdar }
Questions Answers Category Views Company eMail




Answers / { sameer inamdar }

Question { 5353 }

What is the difference between constructor and method?


Answer

Constructor must have the same as the class name,
whereas we can give any name to the method.
Constructor doesnt have any return type not even void,
whereas method must have valid return type or void if
nothing is return.
Constructor will implicitely invoke at the time of
object creation, whereas method must invoke explicitely
with the object.

Is This Answer Correct ?    3 Yes 0 No

Question { Tech Mahindra, 9472 }

What is constructor


Answer

Constructor is a method like other methods but it has
the same as the class name and it has no any return type
not even void.
Connstructor is invoke only once at the time of object
creation. We can overload the constructor.

Is This Answer Correct ?    7 Yes 1 No