接口扩展 TimerTask

Interface extending TimerTask

我正在努力让我的界面在 Java 中扩展 TimerTask。但是我的代码会给出下一个错误:"Interface expected here" at the declaration of the interface.

import java.util.List;
import java.util.TimerTask;


public interface IEffectenBeurs extends TimerTask {

   public List<IFonds> getInfo();

   public void run();

}

TimerTask 是一个抽象class。因此接口不能扩展它。您的 IEffectendBeurs 可以扩展 Runnable 或者您也可以将其转换为抽象 class。