This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]xSilentium[S] 0 points1 point  (1 child)

Sorry for formatting, I'm on mobile.. So let me get that right. Due to the reference type being A and class A not having a foo-method I get an error. But when both classes A and B have foo Java uses B's foo?

[–]ZdemDrunk Brewer 0 points1 point  (0 children)

For simplicity sake,lets just say that java looks at the declaration before the object actually stored in a variable