+ 2

Does Constructor return any Value?

Yes, Constructor return the current instance of a class. Because they are used to initialize an object but constructor does not have any signature of return type

17th Aug 2016, 8:42 PM
Dipayan Pramanik
Dipayan Pramanik - avatar
4 Answers
+ 9
constructor doesn't returns any value as it does not have any return type . remember rules for defining constructor : 1.'Constructor name must be the same name as your class name .' 2.'Constructor is used only to initialize your object.' 3.'constructor is called at the time of object creation.(i.e suppose your class name is A and you create its object say 'A obj=new A()'; as soon as the above statement gets executed constructor gets called automatically)'. 4.Constructor can be of 3 types, i)Simple.ii)Paramitarised.iii)copy constructor.
18th Aug 2016, 5:29 PM
Hardik Raut
Hardik Raut - avatar
+ 1
it returns class, of what it's a method
5th Feb 2017, 5:41 AM
Riftomer Mc
Riftomer Mc - avatar
- 1
no constructor doesnt return any value as it has void return type and NEW keyword is used to initialize an object by default values
18th Aug 2016, 5:26 AM
saurabh pandey
- 3
^
18th Aug 2016, 7:34 AM
Divjot Bedi