Is there a way to guarantee an interface extends a class in Java?

前端 未结 6 1993
你的背包
你的背包 2020-12-28 13:38

Suppose I have the following situation:

public abstract class Vehicle {
  public void turnOn() { ... }
}

public interface Flier {
  public void fly();
}
         


        
6条回答
  •  情歌与酒
    2020-12-28 14:17

    It's a strange requirement, but you can accomplish something of the sort with Generics:

    
    

提交回复
热议问题