I want to call a method of an abstract class from abstract class called by inherit class.
Abstract class:
public abstract class Abstract {
protected void updateMotionY(float deltaTime) {
System.out.println("Abstrcat updateMotionY");
}
public void update(float deltaTime) {
this.updateMotionY(deltaTime);
}
}
Inherit class:
public class Obj extends Abstract {
@Override
protected void updateMotionY(float deltaTime) {
System.out.println("updateMotionY");
super.updateMotionY(deltaTime);
}
@Override
public void update(float deltaTime) {
super.update(deltaTime);
}
}
Main method class:
public static void main(String[] args) {
(new Obj()).update(10.0f);
}
Whenever I try to call new Obj().update()
method in main class, it prints "updateMotionY" and "Abstrcat updateMotionY". I want to get only "Abstrcat updateMotionY".
Can anyone tell me how to resolve this problem?