Why constructor have note return type in java. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Why constructor have note return type in java.

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