Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
No..If a constructor returned value then it would no longer be a constructor Like SomeClass x=new SomeClass() Suppose it returned int then the data types would be incompatible.. Check this code since constructor returns an instance of class by default...So it can't return anything,if it returns then it is automatically overloaded..Check the code for better insight https://code.sololearn.com/cozz3nfu0VeM/?ref=app
9th Apr 2019, 3:31 AM
Saksham Jain
Saksham Jain - avatar