DEV Community

loading...

Discussion on: Java Inheritance Puzzle

Collapse
samwho profile image
Sam Rose

I think it's 1, and it's because the object is always of type ChildOfSuperType no matter what type you store it in, so when the method is dispatched it will always resolve to the version on ChildOfSuperType.

/me goes to check.

Spoiler here for anyone wondering what the answer is: repl.it/@samwho/KnownEnormousWeara...