So, I have an abstract class acting as a parent class, here’s what I want to happen.
In abstract class:
public void run(){
while(!booleanStatement){
//do specific stuff here
}
}
In child class:
public class extends parentClass{
public void run(){
//do child stuff here effected by the while loop above
}
Is there any way to make this happen? super() maybe?
Sure. Just define an additional abstract method:
In this scenario the subclass can’t overwrite
run()and is forced to provide an implementation fordoRun()which does the work inside the loop.