0

Why here the output is "New Animal New Bee" but this questions answer is only "B" and not "A B"?

https://code.sololearn.com/clM9x2f30Tq0/?ref=app

13th Jan 2022, 7:04 PM
Muhammet Ali Özyetimoglu
Muhammet Ali Özyetimoglu - avatar
2 odpowiedzi
0
Is it because of one time it's the constructor and one time it's a method?
13th Jan 2022, 7:09 PM
Muhammet Ali Özyetimoglu
Muhammet Ali Özyetimoglu - avatar
0
What's your actual question ?(about A, B)! Code calls both constructors because of "new Bee();" Bee class extends Animal class so when creating instance, it's super class constrictor first executed , (which causing "New Animal" to print) then it calls it's constructor (which causing "New Bee" to print).
13th Jan 2022, 7:36 PM
Jayakrishna 🇮🇳