Why does it return null | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
28th Mar 2021, 10:46 AM
Azra Fadil
Azra Fadil - avatar
2 Answers
+ 2
That's because you're not passing in the correct arguments to your superclass when you call super(). So, change line 26 to: super(a, b); Also, you don't need that constructor on line 13. If you didn't have that, the way you coded it would've thrown an error instead of printing null.
28th Mar 2021, 10:55 AM
CamelBeatsSnake
CamelBeatsSnake - avatar
+ 1
Thank you for the answer, btw constructor on line 13 is on purpose ( in another case where i want to initialize object)
28th Mar 2021, 11:04 AM
Azra Fadil
Azra Fadil - avatar