public class Cls1{
public foo(){
doX();
}
}
public class Cls2{
public foo(){
doY();
}
}
Cls2 cls = new Cls2();
cls.foo();
Is there a way to do inheritance in java that java runs both doX and doY when the user calls the function with foo?