Why constructor have note return type in java. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why constructor have note return type in java.

31st Dec 2018, 5:44 PM
Surendra Kumar
Surendra Kumar - avatar
2 ответов
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