我知道这个标题很混乱,但我无法想出另一种措辞方式。
So, what I am trying to achieve: I have seen some java programs have a load of subclasses that have a method in their super class, and they all run when the supers method is called. What I am trying to do is make ever single child class of Synchroniser run their own RunAll method when I call the Synchroniser.RunAll method.
我尝试过很多事情,我经常去谷歌,但我发现的东西不适合我。
这就是我有的: 超优等班
public class Synchroniser
{
public Synchroniser()
{
RunAll();
}
protected void RunAll()
{
System.out.println("RunAll");
}
}
小组委员会:
import org.lwjgl.input.Keyboard;
public class ArrayList extends Synchroniser
{
public ArrayList()
{
}
public static void Keybind(Info info)
{
info.Toggle();
}
@Override
protected void RunAll()
{
System.out.println("Ran ArrayList");
}
}