为什么此通用接口(interface)实现无法编译?

//The type Client<T> must implement the inherited abstract method IClient.compareTo(IClient)
class Client<T> implements IClient {

    //The method compareTo(IClient<T>) of type Client<T> must override or implement a supertype method
    //The Eclipse quick fix creates exactly the same supertype method which is defined in the interface.
    @Override
    public int compareTo( IClient<T> o ) {
        return this.getClass().getName().compareTo( o.getClass().getName() );
    }
}

interface IClient<T> extends Comparable<IClient<T>> {

    @Override
    int compareTo( IClient<T> o );

}

最佳答案

 class Client<T> implements IClient<T> {

关于java - 为什么此通用接口(interface)实现无法编译?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5230282/

10-09 19:26