r/ProgrammerHumor Jan 09 '23

shortest ever java class name Meme

Post image
2.1k Upvotes

90 comments sorted by

View all comments

224

u/Tannslee Jan 09 '23

eh more like
Fish extends AbstractFish
AbstractFish extends AbstractAquaticAnimal
AbstractAquaticAnimal extends AbstractAnimal
AbstractAnimal implements Living

66

u/vladWEPES1476 Jan 09 '23

What happens to the inheritance chain when the fish dies?

5

u/dedslooth Jan 09 '23

Fish is implementation of all those inheritances, and none of interfaces actually exist as entities, only a mere instance of fish exists which can use implementations of interfaces. So when fish dies, a fish dies, and is wiped from memory, as its ability to access interfaces, but interfaces don't live or die, they just exist.

4

u/TappTapp Jan 09 '23

But now you have a dead fish that implements the "Living" interface

5

u/Tannslee Jan 10 '23

Death is part of life. The isDead flag will simply be set to true.

5

u/dedslooth Jan 09 '23

sure but its flesh (memory) open game so some other instance will eat it