I have class A
and class B
which extends A
.
class A {
public void play(){
System.out.println("A"):
}
}
class B extends A {
@Override
public void play(){
System.out.println("B"):
}
}
Lets say I have something like that:
A myObj = new B();
((A)myObj).play;
This is still show B
in the system out. Shouldn't it show A
since I upcasted it and I executed play. How can I call the super play given that my object is of type B
?