I am posting a code snippet that does not give any syntax error when an interface extends and abstract class. The interface audio extends abstract class music in the method sort()
import java.util.List;
abstract class music {}
public interface audio {}
abstract class play implements Comparable {
public void sort (List list){
//do something
}
}
I am assuming an interface CAN NOT extend an abstract class. Can any one explain why it is so?
解决方案
In your example, the second "audio" is not the interface, but a type parameter to your generic method. You could just as well name it T.