java通用模板错误

Cap*_*row 3 java generics

为什么我在接口上使用以下定义在eclipse上获得编译错误:
Area是一个接口.

public interface Shape {
     ...  
     public Comparator<T extends Area> getComparator();
}
Run Code Online (Sandbox Code Playgroud)

而不是如果我改为使用:

public interface Shape {
     ... 
     public Comparator<? extends Area> getComparator();
}
Run Code Online (Sandbox Code Playgroud)

zie*_*mer 5

因为编译器不知道T应该是什么或代表什么.现在,如果你有像public interface Shape<T>接口声明这样的东西,我们可能会得到一些东西来处理它.