Why constructor have note return type in java. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why constructor have note return type in java.

31st Dec 2018, 5:44 PM
Surendra Kumar
Surendra Kumar - avatar
2 Answers
0
Because the constructor return a pointer on the object. That's with that pointer you can call class' methods and attributes.
31st Dec 2018, 6:09 PM
Théophile
Théophile - avatar
0
The constructor have already a return type
31st Dec 2018, 6:11 PM
Théophile
Théophile - avatar