So I have a Superclass
and two classes ClassA
and ClassB
that extend Superclass
.
ClassA
and Superclass
contain a method .doSomething()
, ClassB
does not.
I got instances of ClassA and -B in a List<Superclass> objects
. There also is a loop that iterates through objects
and calls .doSomething()
like this:
for(Superclass o : objects){
o.doSomething();
}
My question is: If o
is an instance if ClassA
, is then ClassA.doSomething()
being called or does this loop only call Superclass.doSomething()
?